I am currently calling Worker2 from Worker1 and trying to monitor the progress of Worker2. The problem is, the way I'm monitoring the progress for Worker2 (through a while loop) is causing Worker2 to never run.
Here's what I've got:
Worker2.perform_async(@project_assessment.id)
while true
if @project_assessment.project.status != 'completed'
sleep 20
end
end
generate_report
notify_user
Worker2 never actually runs because of my while loop. However, Worker2 is going to update the project status to completed when it's finished, so how do I properly monitor this without affecting the performance of Worker2?
What you are looking here is something similar to Sidekiq Workflow . But this is available only on Sidekiq-Pro version, which is paid.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.