mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

When a job schema changes, added optional parameters shouldn't cause the job to fail. #149

Open robacarp opened 3 weeks ago

robacarp commented 3 weeks ago

Today I added an optional parameter to a job:

+  param ignore_last_indexed_at : Bool = false 

Several thousand jobs were in queue at the time of deploy and started rapidly failing because they weren't stored with the parameter. It would have been an easier transition to allow those jobs to run as is, and just take the default value of the parameter.

If it's not that way already, job parameters which are no longer present in the definition should also not prevent the job from running. Perhaps this means there should be an "unknown parameters hash" or something similar, following the pattern of StdLib's JSONSerializable.

Crystal version: 0.28.0 Mosquito Shard version: 0.4.0