meskyanichi/hirefire — Issue #39: Nonzero min_workers causes continuous DB requests
Author: vishl
Created: 2011-11-09 04:16:27+00:00
State: open

I set min_workers=1. Now after the worker finishes processing the job (and delayed_jobs table is empty), it appears that the worker is continuously polling the database. Is this the desired behavior?

Log file:
```
2011-11-09T04:09:13+00:00 app[worker.1]: [2011-11-08 20:09:13][HireFire] 1 jobs processed at 0.2002 j/s, 0 failed ...
2011-11-09T04:09:13+00:00 app[worker.1]: SQL (1.4ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:13.578721')
2011-11-09T04:09:13+00:00 app[worker.1]: SQL (1.4ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:13.580942')
2011-11-09T04:09:15+00:00 app[worker.1]: SQL (12.8ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:14.988993')
2011-11-09T04:09:16+00:00 app[worker.1]: SQL (12.0ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:16.853224')
2011-11-09T04:09:16+00:00 app[worker.1]: SQL (1.6ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:16.866073')
2011-11-09T04:09:18+00:00 app[worker.1]: SQL (1.6ms) SELECT COUNT(*) FROM "delayed_jobs" WHERE "delayed_jobs"."failed_at" IS NULL AND (run_at <= '2011-11-09 04:09:18.213203')
and so on...
```