问题
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