debian-mirror-gitlab/app/workers/hashed_storage/base_worker.rb

25 lines
526 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module HashedStorage
class BaseWorker
include ExclusiveLeaseGuard
2019-12-21 20:55:43 +05:30
include WorkerAttributes
feature_category :source_code_management
2019-07-07 11:18:12 +05:30
LEASE_TIMEOUT = 30.seconds.to_i
2019-12-04 20:38:33 +05:30
LEASE_KEY_SEGMENT = 'project_migrate_hashed_storage_worker'
2019-07-07 11:18:12 +05:30
protected
def lease_key
# we share the same lease key for both migration and rollback so they don't run simultaneously
"#{LEASE_KEY_SEGMENT}:#{project_id}"
end
def lease_timeout
LEASE_TIMEOUT
end
end
end