Welcome to mirror list, hosted at ThFree Co, Russian Federation.

base_worker.rb « hashed_storage « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 372440996d9997240f9ce601712333b584dd7aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module HashedStorage
  class BaseWorker # rubocop:disable Scalability/IdempotentWorker
    include ExclusiveLeaseGuard
    include WorkerAttributes

    feature_category :source_code_management

    LEASE_TIMEOUT = 30.seconds.to_i
    LEASE_KEY_SEGMENT = 'project_migrate_hashed_storage_worker'

    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