Class: Gitlab::Database::BackgroundOperation::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/background_operation/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection:, executor: Executor.new(connection: connection)) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
# File 'lib/gitlab/database/background_operation/runner.rb', line 7

def initialize(connection:, executor: Executor.new(connection: connection))
  @connection = connection
  @executor = executor
end

Instance Method Details

#run_operation_job(worker) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/database/background_operation/runner.rb', line 12

def run_operation_job(worker)
  next_job = find_or_create_next_job(worker)

  if next_job
    execute_job_and_handle_failure(worker, next_job)
  else
    finish_active_operation(worker)
  end
end