Quantcast
Channel: Antarctica Starts Here.
Viewing all articles
Browse latest Browse all 210

Clearing stuck jobs in Huginn

$
0
0

From time to time the job workers in Huginn will lock up. This usually happens if they are subjected to an external resource which can be contacted but never seems to respond. A stuck webapp on the other end is usually the problem. If the connection never dies, or takes a long time to time out it can wreak havoc. However, there's a relatively easy way to fix this. First, you have to shut down your job workers. Depending on how many you have this can take a while... once they're down, though, it's a relatively simple matter to use the Rails console to clean out the bad jobs.

drwho@exocortex:$cd/path/to/huginndrwho@exocortex:$source.env#The--environment=prod bit might be redundant, but it couldn't hurt.#Also,thiscantakeafewminutestocomeupsobepatient.drwho@exocortex:$bundleexecrailsconsole--environment=prod

Once the Rails console is up, the following command will blow away the cruft:

Delayed::Job.where("locked_at IS NOT NULL AND locked_by IS NOT NULL AND failed_at IS NULL").destroy_all

This command can take a while to finish. The longest I've waited is about ten minutes. But it will finish. When it does, you can turn the above command into a read-only query to see if there are any bad jobs left:

Delayed::Job.where("locked_at IS NOT NULL AND locked_by IS NOT NULL AND failed_at IS NULL")

However, there shouldn't be.


Viewing all articles
Browse latest Browse all 210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>