EverythingMe/redash — pull request #281 by arikfr (2014-09-11 04:46:46+00:00)
Title: Several fixes to reduce cases of stuck jobs

Due to the locking mechanism we have, that prevents same query from being executed more than once at a time, some queries might get into a "limbo" state and stop being executed until the lock is manually removed.

This pull request adds some fixes to reduce (eliminate?) those cases:

1. Set expiry time to locks (default: 12 hours).
2. If lock found is of a "ready" job (finished, revoked or failed), ignore it and execute a new job.
3. Cleanup job that removes locks of non existing tasks (might happen after cold restart of the worker).