10

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.
Andrew Cox
  • 165
  • 1
  • 10

1 Answers1

11

It is not safe. You can do this:

class A
end
B = A

to alias B to A instead of copying the code.

Mike Perham
  • 21,300
  • 6
  • 59
  • 61