resque-scheduler icon indicating copy to clipboard operation
resque-scheduler copied to clipboard

Counting jobs for queue X that have to run at `Time.now`?

Open mrrooijen opened this issue 11 years ago • 2 comments

Hi,

How would one go about counting specific and all queues sizes that are set to run right Time.now? I have had some requests to support Resque scheduler for a service and require these metrics in order to do so.

I need to be able to do something along lines of:

returns an Integer representing all jobs that must run "now" for all queues

ResqueScheduler.queue # => 23

returns an Integer representing all jobs that must run "now" for the :urgent queue

ResqueScheduler.queue(:urgent) # => 5

Is there a way to do this? If so, what logic would go here to accomplish this?

class ResqueScheduler
  def self.queue(queue = nil)
    # ...
  end
end

Any help much appreciated! Thanks!

mrrooijen avatar Nov 15 '12 15:11 mrrooijen

@meskyanichi This does not seem to be a bug. It is more of a feature request. Can you make a case, that your particular idea may have more value for average users of resque-scheduler? We could add those statistics in the UI itself. If you have already solved this problem, let us know how you did it.

If @meatballhat @bugant, do you think this could be a feature for resque-scheduler?

ksinkar avatar Feb 14 '14 13:02 ksinkar

@ksinkar I think @meskyanichi definitely meant it as a feature request :smiley: Considering how long it's been since this issue was created, I would ask if it's even wanted anymore. If so, it seems reasonable to me to take a crack at implementing something that would go out with v3.x.x.

meatballhat avatar Feb 14 '14 13:02 meatballhat