From fa3cb1925db87813bdefcec3ef9f7f0e7cd795da Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Thu, 23 Sep 2021 09:59:26 +0200 Subject: [PATCH] Fixes: #3765 - Possible race condition causing OTRS import to fail --- ...23075329_remove_otrs_diff_worker_scheduler_entry.rb | 10 ++++++++++ db/seeds/schedulers.rb | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20210923075329_remove_otrs_diff_worker_scheduler_entry.rb diff --git a/db/migrate/20210923075329_remove_otrs_diff_worker_scheduler_entry.rb b/db/migrate/20210923075329_remove_otrs_diff_worker_scheduler_entry.rb new file mode 100644 index 000000000..0cef69cb5 --- /dev/null +++ b/db/migrate/20210923075329_remove_otrs_diff_worker_scheduler_entry.rb @@ -0,0 +1,10 @@ +# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ + +class RemoveOtrsDiffWorkerSchedulerEntry < ActiveRecord::Migration[6.0] + def change + # return if it's a new setup + return if !Setting.exists?(name: 'system_init_done') + + Scheduler.find_by(method: 'Import::OTRS.diff_worker')&.destroy + end +end diff --git a/db/seeds/schedulers.rb b/db/seeds/schedulers.rb index b75fd595a..84f39831b 100644 --- a/db/seeds/schedulers.rb +++ b/db/seeds/schedulers.rb @@ -21,15 +21,6 @@ Scheduler.create_if_not_exists( prio: 1, active: true, ) -Scheduler.create_if_not_exists( - name: 'Import OTRS diff load', - method: 'Import::OTRS.diff_worker', - period: 3.minutes, - prio: 1, - active: true, - updated_by_id: 1, - created_by_id: 1, -) Scheduler.create_if_not_exists( name: 'Check Channels', method: 'Channel.fetch',