Module: Gitlab::BitbucketServerImport::ParallelScheduling
- Includes:
- Loggable
- Included in:
- Importers::LfsObjectsImporter, Importers::NotesImporter, Importers::PullRequestsImporter
- Defined in:
- lib/gitlab/bitbucket_server_import/parallel_scheduling.rb
Constant Summary collapse
- ALREADY_PROCESSED_CACHE_KEY =
The base cache key to use for tracking already processed objects.
'bitbucket-server-importer/already-processed/%{project}/%{collection}'- JOB_WAITER_CACHE_KEY =
The base cache key to use for storing job waiter key
'bitbucket-server-importer/job-waiter/%{project}/%{collection}'- JOB_WAITER_REMAINING_CACHE_KEY =
The base cache key to use for storing job waiter remaining jobs
'bitbucket-server-importer/job-waiter-remaining/%{project}/%{collection}'
Instance Attribute Summary collapse
-
#already_processed_cache_key ⇒ Object
readonly
Returns the value of attribute already_processed_cache_key.
-
#enqueued_job_counter ⇒ Object
Returns the value of attribute enqueued_job_counter.
-
#job_waiter_cache_key ⇒ Object
readonly
Returns the value of attribute job_waiter_cache_key.
-
#job_waiter_remaining_cache_key ⇒ Object
readonly
Returns the value of attribute job_waiter_remaining_cache_key.
-
#page_counter ⇒ Object
readonly
Returns the value of attribute page_counter.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project) ⇒ Object
project - An instance of
Project.
Methods included from Loggable
#log_debug, #log_error, #log_info, #log_warn
Instance Attribute Details
#already_processed_cache_key ⇒ Object (readonly)
Returns the value of attribute already_processed_cache_key.
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 8 def already_processed_cache_key @already_processed_cache_key end |
#enqueued_job_counter ⇒ Object
Returns the value of attribute enqueued_job_counter.
11 12 13 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 11 def enqueued_job_counter @enqueued_job_counter end |
#job_waiter_cache_key ⇒ Object (readonly)
Returns the value of attribute job_waiter_cache_key.
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 8 def job_waiter_cache_key @job_waiter_cache_key end |
#job_waiter_remaining_cache_key ⇒ Object (readonly)
Returns the value of attribute job_waiter_remaining_cache_key.
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 8 def job_waiter_remaining_cache_key @job_waiter_remaining_cache_key end |
#page_counter ⇒ Object (readonly)
Returns the value of attribute page_counter.
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 8 def page_counter @page_counter end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 8 def project @project end |
Instance Method Details
#initialize(project) ⇒ Object
project - An instance of Project.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gitlab/bitbucket_server_import/parallel_scheduling.rb', line 26 def initialize(project) @project = project @page_counter = Gitlab::Import::PageCounter.new(project, collection_method, 'bitbucket-server-importer') @already_processed_cache_key = format(ALREADY_PROCESSED_CACHE_KEY, project: project.id, collection: collection_method) @job_waiter_cache_key = format(JOB_WAITER_CACHE_KEY, project: project.id, collection: collection_method) @job_waiter_remaining_cache_key = format(JOB_WAITER_REMAINING_CACHE_KEY, project: project.id, collection: collection_method) # The enqueued job counter is used to calculate job delays and distribute # them over time. When the stage worker restarts, the counter resets to # prevent jobs from being queued too far into the future. Such logic may # result in more jobs being executed when the stage worker resumes. An # alternative solution would complicate the delay logic, so for simplicity # we accept more jobs being executed. @enqueued_job_counter = 0 end |