Andrew Cox
Andrew Cox

Reputation: 165

Is it safe to rename a Sidekiq worker with jobs still in the queue?

Can I rename a Sidekiq worker and deploy it in one step without worrying about jobs getting orphaned looking for the previous name? Or do I need to do a 2-step deploy to make sure the original jobs have drained from the queue before deleting the original worker?

For example, if I wanted to rename EmailSignupWorker to EmailRegistrationWorker, do I neeed to:

  1. Create a new EmailRegistrationWorker with the same contents as EmailSignupWorker and use that new worker for all instances where EmailSignupWorker was being used.
  2. Deploy.
  3. Wait for any EmailSignupWorker jobs to drain.
  4. Delete EmailSignupWorker.
  5. Deploy.

Upvotes: 10

Views: 1545

Answers (1)

Mike Perham
Mike Perham

Reputation: 22228

It is not safe. You can do this:

class A
end
B = A

to alias B to A instead of copying the code.

Upvotes: 11

Related Questions