Class: Gitlab::SidekiqMiddleware::PauseControl::StrategyHandler
- Inherits:
-
Object
- Object
- Gitlab::SidekiqMiddleware::PauseControl::StrategyHandler
- Defined in:
- lib/gitlab/sidekiq_middleware/pause_control/strategy_handler.rb
Instance Method Summary collapse
-
#initialize(worker_class, job) ⇒ StrategyHandler
constructor
A new instance of StrategyHandler.
-
#perform(&block) ⇒ Object
This will continue the server middleware chain if the job should be executed.
-
#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.
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 |