How to set timeout for tasks in sidekiq

I had a problem with sidekiq:
I want to set a timeout for jobs, which means that when the job has a processing time longer than the timeout, then it will stop.

I was looking for how to set global timeout configuration in sidekiq.yml file.
But I want to set a separate timeout for the difference of individual tasks, that is, one of the classes for determining the worker will have a specific timeout configuration.
Can you help me.
Many thanks.

+7
ruby ruby-on-rails sidekiq
source share
1 answer

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

You can set network timeouts on any third-party calls you make so that they do not go out.

+9
source share

All Articles