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

Handle celery errors by re-running async task #14

Merged
merged 7 commits into from
Feb 4, 2020

Conversation

demianbrecht
Copy link
Member

No description provided.

@demianbrecht demianbrecht requested a review from dshafer January 30, 2020 00:33
return
except kombu.exceptions.OperationalError as err:
logger.warn('kombu.exceptions.OperationalError')
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log how many attempts we're at and if we hit 3?

except kombu.exceptions.OperationalError as err:
logger.warn('kombu.exceptions.OperationalError (attempt: %s)', attempt)
if attempt >= MAX_ATTEMPTS - 1:
raise err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have the option to fall back to running the task synchronously, perhaps controlled by a django setting, or else an option in the DeferrableTask decorator

@dshafer
Copy link
Collaborator

dshafer commented Feb 3, 2020

I like DECLARATIVE_ENDPOINT_FORCE_SYNCHRONOUS_TASKS, but what I'm looking for is a bit different - I think it might be useful to have an option to run tasks synchronously only if we fail to run them in the queue. So we try to do the right thing (queue/async), but fall back to synchronous processing if the queue goes wrong for some reason.

@demianbrecht
Copy link
Member Author

@dshafer so demanding ;) Should be satisfied by the most recent commit.

Copy link
Collaborator

@dshafer dshafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

@demianbrecht demianbrecht merged commit 4c67836 into salesforce:master Feb 4, 2020
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

Successfully merging this pull request may close these issues.

3 participants