niborg
niborg

Reputation: 419

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.

Upvotes: 1

Views: 94

Answers (1)

Mike Perham
Mike Perham

Reputation: 22208

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.

Upvotes: 2

Related Questions