Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching exceptions when Celery broker is down #12

Open
antonpirker opened this issue Sep 23, 2015 · 1 comment
Open

Catching exceptions when Celery broker is down #12

antonpirker opened this issue Sep 23, 2015 · 1 comment

Comments

@antonpirker
Copy link

Hello!

First: thank's for this package, it is really useful in our project!
I have one problem: In one of my views a signal is triggered which then calls a celery task like this:

def post_save_donation(sender, instance, created, raw, using, **kwargs):
    create_something.delay(pk)

post_save.connect(post_save_donation, sender=Donation)

The task is defined like this:

from djcelery_transactions import task

@task
def create_something(donation_pk):
    # do something

Everything works great, but:

If RabbitMQ is down when I am calling the task no error is thrown during the create_something.delay(pk) call. But the view throws this error:

[Errno 111] Connection refused

The question now is: Why is this error thrown in the view but not in the signal handler where the create_something.delay(pk) is called?

Any help is greatly appreciated

@nicolasgrasset
Copy link
Owner

I think you're simply not trying to catch the error in the signal, so it's bubbling up to the highest level, and the Django view will catch it if you don't.

Make sure to add a try...except in your signal.

Let me know if I misunderstand the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants