rails / solid_queue

Database-backed Active Job backend
MIT License
1.95k stars 130 forks source link

Should delete the old recurring task when the task changed key, or removed #382

Open iuhoay opened 1 month ago

iuhoay commented 1 month ago

When the key of a recurring task is changed or the task is removed, should the old task be automatically deleted? This is to ensure that outdated tasks do not continue to run.

brettallred commented 1 month ago

I was wondering the same thing.

We had a recurring task defined in recurring.yml. After deploy it began running on the regular schedule. I added three more recurring tasks and removed the original task. However, in the recurring tasks, it is still being executed.

I'm about to look into the internals now, but I'm assuming that the yml file is being read and creating records in the DB. We probably need to remove the DB entry manually for now but wondering if this is a known issue.

rosa commented 1 month ago

Hey! Are you sure the removed task is still running or just listed in Mission Control but not running? See

iuhoay commented 1 month ago

Got it, thanks a lot! @rosa

antulik commented 1 week ago

@rosa I can confirm the removed task is indeed running.

rosa commented 1 week ago

@antulik how can you confirm this? Do you have examples of solid_queue_recurring_executions records created after you've deleted the task from the config and redeployed, restarting the processes?

antulik commented 1 week ago

My apologies, I didn't look deep enough. Execution is not scheduled. To be more specific for a removed cron task:

rosa commented 1 week ago

Ahhh, makes sense. I'm going to fix this confusion in any case very soon, making sure recurring tasks that are removed from the config are also removed from the DB.

rosa commented 1 week ago

Actually going to reopen this one to track that.