I am currently using Sidekiq with the help of Sidekiq-Unique-Jobs and Sidekiq-Status to perform tasks on my application.
Jobs performed by workers are small and almost always executed immediately. (little or no queue at all)
I am "hacking" sidekiq to perform tasks synchronously (check Controller can't find object created by worker), these jobs are small and fast to execute (less than 1 second usually). And my application needs to run the jobs synchronously and get its details (object created/updated)
With the solution I am using, creating a queue and ensuring via params (sidekiq-unique-jobs) that no more than 1 job is simultaneously executed by the same user I can avoid all deadlocks, however I feel that it should be a better way to perform this, rather than hacking sidekiq since it's meant to perform jobs asynchronously.
The question is: Is there any alternative or similar gem to sidekiq in the way that I can limit inputs BUT which is by default meant to be run synchronously? I can't just ask on controller Balance.find_or_create_by(user: user, market: market)
because sooner or later it will give me deadlocks but I feel that this sidekiq solution I'm using is also not ok on the long term. Am I missing something basic here??
Thanks
Aucun commentaire:
Enregistrer un commentaire