Class: Operations::Task::Runner

Inherits:
Object
  • Object
show all
Defined in:
app/models/operations/task/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



3
4
5
# File 'app/models/operations/task/runner.rb', line 3

def initialize
  @stopped = false
end

Class Method Details

.startObject



24
# File 'app/models/operations/task/runner.rb', line 24

def self.start = new.start

Instance Method Details

#startObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/operations/task/runner.rb', line 7

def start
  puts "Starting #{self.class.name}"
  register_signal_handlers
  puts "...signal handlers registered"
  until @stopped
    Rails.application.eager_load! if Rails.env.development? # Ensure all sub-classes are loaded in dev mode
    Task.wake_sleeping
    Task.delete_old
    sleep 30
  end
  puts "...stopping"
end

#stopObject



20
21
22
# File 'app/models/operations/task/runner.rb', line 20

def stop
  @stopped = true
end