2019-10-14 15:06:07 +00:00
|
|
|
# frozen_string_literal: true
|
2019-02-20 15:35:57 +00:00
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class ScheduleMigrateExternalDiffsWorker # rubocop:disable Scalability/IdempotentWorker
|
2019-02-20 15:35:57 +00:00
|
|
|
include ApplicationWorker
|
2021-04-30 18:10:09 +00:00
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2020-02-05 18:09:06 +00:00
|
|
|
# rubocop:disable Scalability/CronWorkerContext:
|
|
|
|
# This schedules the `MigrateExternalDiffsWorker`
|
|
|
|
# issue for adding context: https://gitlab.com/gitlab-org/gitlab/issues/202100
|
|
|
|
include CronjobQueue
|
|
|
|
# rubocop:enable Scalability/CronWorkerContext:
|
|
|
|
|
2019-02-20 15:35:57 +00:00
|
|
|
include Gitlab::ExclusiveLeaseHelpers
|
|
|
|
|
2020-12-02 18:09:35 +00:00
|
|
|
feature_category :code_review
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2019-02-20 15:35:57 +00:00
|
|
|
def perform
|
|
|
|
in_lock(self.class.name.underscore, ttl: 2.hours, retries: 0) do
|
|
|
|
MergeRequests::MigrateExternalDiffsService.enqueue!
|
|
|
|
end
|
|
|
|
rescue Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
|
|
|
|
end
|
|
|
|
end
|