Michael
Michael

Reputation: 1622

Finding Resque Scheduler Jobs Programmatically

In Rails, you can easily get at the basic info of workers, jobs pending, etc. via Resque.info hash. How can you determine how many jobs are in the Resque Scheduler Delayed Jobs (one-off scheduled) tab programmatically?

For example, I see 0 pending jobs in Resque.info but can see 5 jobs under the Delayed tab in Resque Web view. How could I return that 5 (total count or objects)?

Upvotes: 0

Views: 490

Answers (1)

Michael
Michael

Reputation: 1622

For those that may need this in the future, I looked more deeply into how the server page displayed it, and found it uses the method:

Resque.delayed_queue_peek, e.g. Resque.delayed_queue_peek(1, 20)

Internals available here: https://github.com/resque/resque-scheduler/blob/master/lib/resque/scheduler/delaying_extensions.rb

Upvotes: 0

Related Questions