diff --git a/lib/solid_queue/scheduler/recurring_schedule.rb b/lib/solid_queue/scheduler/recurring_schedule.rb index 5b8ff6bb..4070a0ec 100644 --- a/lib/solid_queue/scheduler/recurring_schedule.rb +++ b/lib/solid_queue/scheduler/recurring_schedule.rb @@ -41,6 +41,7 @@ def task_keys private def persist_tasks + SolidQueue::RecurringTask.static.where.not(key: task_keys).delete_all SolidQueue::RecurringTask.create_or_update_all configured_tasks end diff --git a/test/integration/recurring_tasks_test.rb b/test/integration/recurring_tasks_test.rb index aa48c12a..7367bc06 100644 --- a/test/integration/recurring_tasks_test.rb +++ b/test/integration/recurring_tasks_test.rb @@ -64,13 +64,13 @@ class RecurringTasksTest < ActiveSupport::TestCase scheduler1 = SolidQueue::Scheduler.new(recurring_tasks: another_task).tap(&:start) wait_for_registered_processes(6, timeout: 1.second) - assert_recurring_tasks configured_task.merge(another_task) + assert_recurring_tasks another_task updated_task = { example_task: { class: "AddToBufferJob", schedule: "every minute" } } scheduler2 = SolidQueue::Scheduler.new(recurring_tasks: updated_task).tap(&:start) wait_for_registered_processes(7, timeout: 1.second) - assert_recurring_tasks configured_task.merge(updated_task) + assert_recurring_tasks updated_task terminate_process(@pid) scheduler1.stop