dimanche 25 septembre 2022

Avoid duplicate sidekiq job

I have a worker that runs when the user selects a time. If the user selects a time twice, the worker runs twice. How do I avoid it from being executed multiple times? I mean, If the user selects to be executed after 10 minutes, then deletes this request and again selects to be executed after 10 minutes, the worker executed twice.

class EnableWorker
  include Sidekiq::Worker
  sidekiq_options queue: :general, retry: 0

  def perform(enable_at)
    puts enable_at
  end
end

Aucun commentaire:

Enregistrer un commentaire