After problems with our mail server and the connection to elasticsearch, there are 1.8 million jobs on hold. The number drops very slowly(80 per Minute) the problem is that he no longer sends messages because he is busy with the queue. Is there any way to empty the queue without compromising the consistency of the database?
Expected behavior:
cleanup background jobs faster
Actual behavior:
background job quantity 80 jobs per minute
Steps to reproduce the behavior:
lost Connection to Elastic Search and Mail Server(fixed)
The Problem at your end is, that you currently can’t ensure that there’s not some background jobs like sending notifications, E-Mails or other trigger based stuff.
So destroying / deleting all background jobs would give you quite a hard time, as those E-Mail-Jobs would get lost as well.
You can use the following untested command on zammads rails console. Please to a snapshot of your machine, if possible. This should delete only the backgroundjobs for updating search indexes.
Delayed::Job.where("handler LIKE '%BackgroundJobSearchIndex%'").destroy_all
After doing that, you also need to recreate your searchindex, as it should have drifted away from your productive data quite a lot.