ixti / sidekiq-throttled

Concurrency and rate-limit throttling for Sidekiq
MIT License
698 stars 75 forks source link

Reset enqueued_at on re-enqueuing job #189

Closed bdegomme closed 3 months ago

bdegomme commented 3 months ago

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.

mnovelo commented 3 months ago

To me, changing the enqueued_at is essentially rescheduling the job. I'd love to see this as a configurable option as part of https://github.com/ixti/sidekiq-throttled/pull/150

bdegomme commented 3 months ago

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