Puja Garg
Puja Garg

Reputation: 251

How to fetch Sidekiq job from deadset using argument

Hi I want to fetch job from sidekiq deadset I tried using jobs = Sidekiq::DeadSet.new but this will give all the dead jobs, can we do something to fetch particular job which have certain argument. suppose my sidekiq job was XYZWorker [1,2,3] with these three argument, so I want to fetch this job from deadset and retry it.

Upvotes: 1

Views: 806

Answers (1)

Ibraheem Ahmed
Ibraheem Ahmed

Reputation: 13538

Once you create a deadset, you can iterate through it and perform operations on the jobs that match your requirements:

ds = Sidekiq::DeadSet.new
    ds.select do |job|
        if job.args[0] == 1 && job.args[1] == 2 && job.args[2] == 3
        # Do something
    end
end

Upvotes: 1

Related Questions