Search code examples
ruby-on-railsruby-on-rails-4sidekiq

Rails 4.2/Sidekiq -- how refactoring job code affects already scheduled jobs


We are using Rails 4.2 and Sidekiq for processing jobs. Our application schedules jobs to be performed at some point in the future for our users, and thus we have probably thousands of currently scheduled jobs awaiting execution.

I am doing some substantial refactoring of the code underlying these jobs, changing the parameters and whatnot. My question is: when I deploy my new code, will the currently pending jobs -- which were scheduled using the old code -- be affected by my new code when they run?

I assume the answer is no, and that scheduled jobs include the code they are to process. But I'd feel a lot better with some confirmation. My googling did not reveal an answer.


Solution

  • Consider jobs stored in Redis to be exactly like data in a database. If you want to change them, you need to have a proper migration.

    So the answer to your question is yes. The scheduled jobs will use the code that is deployed when they run, not when they were scheduled.