Querying sidekiq for models queued

混江龙づ霸主 提交于 2019-12-11 04:52:10

问题


I have a gallery with photos, on which processing photos is through sidekiq.

When a gallery has photos that are processing or in queue, I'd like to write something in the page.

one option for this is to mark each photo with processing when it is added to the queue, and let sidekiq worker remove that when finished. The downside is that I need to check if at least one photo is processing, meaning check all photos...

Is there a way to query sidekiq directly?


回答1:


You can use the sidekiq-status gem to track your jobs. You can then use code like Sidekiq::Status::working? job_id to check if a specific job is running.



来源:https://stackoverflow.com/questions/25971649/querying-sidekiq-for-models-queued

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!