Sidekiq + ActiveJob callbacks run too fast
|Added at||2017-01-05 23:01|
I use Sidekiq with ActiveJob and its callbacks. At the beginning I'd like to say that my problem sounds very similar to this one: https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting#cannot-find-modelname-with-id12345 however I don't use ActiveRecord callbacks.
I have a service having the method like this:
Which means it creates many jobs that are performed concurrently. In the job I use
In the case above it often happens that when a few jobs are running concurrently I send a notification a few times instead of only one. In a few jobs it goes to the end instead of only once in a first job that is run.
In the case above it happens that decrementing is not on time and because of that the object status is not updated correctly and a notification is never sent. For example when the
Is it possible to fix those cases somehow? Cheers