Class: Gitlab::SidekiqMiddleware::PauseControl::StrategyHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/sidekiq_middleware/pause_control/strategy_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(worker_class, job) ⇒ StrategyHandler

Returns a new instance of StrategyHandler.



7
8
9
10
# File 'lib/gitlab/sidekiq_middleware/pause_control/strategy_handler.rb', line 7

def initialize(worker_class, job)
  @worker_class = worker_class
  @job = job
end

Instance Method Details

#perform(&block) ⇒ Object

This will continue the server middleware chain if the job should be executed. It will return false if the job should not be executed.



21
22
23
# File 'lib/gitlab/sidekiq_middleware/pause_control/strategy_handler.rb', line 21

def perform(&block)
  PauseControl.for(strategy).new.perform(job, &block)
end

#schedule(&block) ⇒ Object

This will continue the middleware chain if the job should be scheduled It will return false if the job needs to be cancelled



14
15
16
# File 'lib/gitlab/sidekiq_middleware/pause_control/strategy_handler.rb', line 14

def schedule(&block)
  PauseControl.for(strategy).new.schedule(job, &block)
end