zlacker

[parent] [thread] 1 comments
1. welder+(OP)[view] [source] 2022-09-06 13:03:29
WakaQ re-forks workers that crash, but normally a crash means an exception was raised in application task code.

I do a combination of a few things to handle exceptions in tasks:

1. `@wakaq.task(max_retries=X)` auto retries the task on soft timeouts, which are usually intermittent and faster the second time the task runs

2. use error handling to track task failure rates https://gist.github.com/alanhamlett/365d48276ac054ae75e59525...

3. build tasks to expect some failures by being safe to re-run without, for ex: sending an email twice. this usually means exclusive locking in tasks or keeping counters of recent task runs or task progress somewhere

4. try catch blocks inside tasks, which rollback and re-enqueue the same task to retry later

Basically I handle all crashes at the application task level, not in WakaQ.

replies(1): >>avinas+F4
2. avinas+F4[view] [source] 2022-09-06 13:29:42
>>welder+(OP)
Thank you for explaining! I think this should part of the README. I am going through the code and loving the simplicity of it!
[go to top]