stratis
stratis

Reputation: 8052

Retrieve Queue position in sidekiq

I've skimmed through the docs but haven't found anything yet.

Is it possible the retrieve the current position of a given job within Sidekiq's queue?

My use case is 2 workers over the default queue with hundreds of tasks of variable complexity. So if for example I submit a new task now and the queue size is say 10, how can I determine the position of my task after 5 minutes?

Thanks.

Upvotes: 0

Views: 167

Answers (1)

Mike Perham
Mike Perham

Reputation: 22228

You can't without a linear scan of the entire queue; the position will change millisecond by millisecond as jobs are fetched and executed.

Sidekiq::Queue.new("default").each do |job|
  p job
end

Upvotes: 1

Related Questions