ixti/sidekiq-throttled

Reset enqueued_at on re-enqueuing job

bdegomme opened this issue · 2 comments

By default when a job is throttled and re-enqueued, its "enqueued_at" value stays the same. This enqueued_at value is used by sidekiq to compute the latency of a queue, so the latency of a queue with throttled jobs will keep growing.
I'm using queue latency as a metric to handle auto-scaling (if latency is high then scale-up). However scaling-up makes no sense if the high queue latency is due to throttled jobs.
Therefore I'd like to know if it's possible to reset a job's enqueued_at value upon re-enqueuing? Which will make sure the queue latency doesn't grow due to throttled jobs.

To me, changing the enqueued_at is essentially rescheduling the job. I'd love to see this as a configurable option as part of #150

Thanks, you're right, that PR would allow me to resolve my issue