Skip to content

Understanding threshold strategy behavior #186

Answered by ixti
jeffbax asked this question in Q&A
Discussion options

You must be logged in to vote

sidekiq-throttled is only controls rate of execution. Not uniqueness. To solve the problem you have, in one of the projects I used redlock with debounced workers implementation.

The problem we were solving was:

  • Ensure that job is executed at least 5 minutes after it was enqueued
    • if it gets re-enqueued within that period of time - push execution back
    • if enqueue pressure is not reduced - execute the job with once every N minutes to avoid starvation in case of endless loop
  • Ensure only one job per user is executed

Debounced Workers

lib/sidekiq/debounced_job.rb
# file: lib/sidekiq/debounced_job.rb
module Sidekiq
  # Implement cheap debounce logic using Sidekiq scheduled jobs and Redis.
  m…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@jeffbax
Comment options

Answer selected by jeffbax
Comment options

You must be logged in to vote
4 replies
@jeffbax
Comment options

@ixti
Comment options

@ixti
Comment options

@jeffbax
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants