Giter Club home page Giter Club logo

Comments (5)

svetlyak40wt avatar svetlyak40wt commented on June 7, 2024

I believe, you have to use two functions here. One will be an actual signal handler. Another - is a job. A signal handler should just schedule a job and exit, probably it even could be a lambda function.

from django-rq.

ouhouhsami avatar ouhouhsami commented on June 7, 2024

Thanks, ... so you propose this ?

from django.db.models.signals import post_save
from django_rq import job

@job
def async_after_save_instance(foo):
    print foo

def after_save_instance_handler(sender, foo, **kwargs):
    async_after_save_instance.delay(foo)

post_save.connect(after_save_instance_handler, sender=MyModel)

from django-rq.

svetlyak40wt avatar svetlyak40wt commented on June 7, 2024

Yeah. And probably, you could use post_save.connect (lambda sender, foo, *kwargs: asynchronous_job.delay()) instead of separate function.

from django-rq.

svetlyak40wt avatar svetlyak40wt commented on June 7, 2024

Or, of cause, a special decorator could be written, but it will be rational only if you have many asynchronous signal handlers.

from django-rq.

ui avatar ui commented on June 7, 2024

Closing this issue, I'd also do what @svetlyak40wt suggested.

from django-rq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.