-
-
Save jk779/27bac33e486aef9ee3c1cc8fc1e9fc3a to your computer and use it in GitHub Desktop.
Kill sidekiq jobs by process id for busy jobs and by jid for other sets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FOR BUSY JOBS | |
# take the process_id from the /busy page in sidekiq and kill the longest running one. | |
workers = Sidekiq::Workers.new | |
workers.each do |process_id, thread_id, work| | |
process = Sidekiq::Process.new('identity' => process_id) | |
process.stop! if process_id == 'integration.3:4:71d1d7f4ef5a' | |
end | |
# FOR SCHEDULED JOBS | |
# you need to know the jid to make this happen | |
job = Sidekiq::ScheduledSet.new.find_job('e460064eda529b97e93314d4') | |
job.delete # will just remove the job | |
# FOR RETRY JOBS | |
# you need to know the jid to make this happen | |
job = Sidekiq::RetrySet.new.find_job('e460064eda529b97e93314d4') | |
job.delete # will just remove the job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment