How set timeout for jobs in sidekiq

北城以北 提交于 2020-04-10 07:28:06

问题


I encountered an issue with sidekiq:
I want to set timeout for jobs, meaning when a job has process time greater than timeout then that job will stop.

I have searched how to set global timeout config in file sidekiq.yml.
But I want to set separate timeout for difference separate jobs meaning one of classes to define worker will have particular timeout config.
Can you help me.
Thanks so much.


回答1:


There's no approved way to do this. You cannot stop a thread safely while it is executing. You need to change your job to check periodically if it should stop.

You can set network timeouts on any 3rd party calls you are making so that they time out.



来源:https://stackoverflow.com/questions/35474555/how-set-timeout-for-jobs-in-sidekiq

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