Sidekiq queue growing

AI-generated summary

The discussion revolves around a growing Sidekiq queue with over 6,000 jobs, primarily linked to the DetectTranslation job from a translation plugin. Jose_C_Gomez explains that even after removing the plugin and rebuilding, the jobs remain. He successfully cleared them using a Rails console command to delete jobs with the Jobs::DetectTranslation class Jose_C_Gomez. He also asks about increasing Sidekiq threads. bartv shares a similar issue with Jobs::ProcessPost jobs and proposes a script to delete jobs with a post_id below a certain threshold, which he later confirms works bartv.

I’ve got more than 6K items in my sidekiq queue and growing


It appears to be related to the transaltion plugin in

I’ve removed the plugin and rebuilt but the queue still has the jobs. Any way to clear the queue of these DetectTranslation jobs?

I was able to do this via the rails console

./launcher enter app
rails c
queue = Sidekiq::Queue.new("default")
queue.each do | job |
    job.delete if job.klass == 'Jobs::DetectTranslation'
end

Additionally is there any way to increase the threads in sidekiq?

I have an issue with my queue too - apparently we rebaked some posts at a too high rate. Can someone help me tweak the script above to:

  • Work on Jobs:ProcessPost
  • Delete all jobs where post_id is below a certain value

Edit: I think I’ve worked it out, how’s this?

queue = Sidekiq::Queue.new("default")
queue.each do | job |
	job.delete if (job.klass == 'Jobs::ProcessPost' && job.args[0]["post_id"] <= 123456 )
end