Class: Delayed::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/app/models/delayed/worker.rb

Overview

Override the start and stop of the worker itself to capture start/end of the worker lifecycle

Instance Method Summary collapse

Instance Method Details

#startObject

Starting the worker



11
12
13
14
# File 'lib/app/models/delayed/worker.rb', line 11

def start
  super
  Delayed::Jobs::Worker.find_or_create_server
end

#stopObject

Stop the worker



19
20
21
22
# File 'lib/app/models/delayed/worker.rb', line 19

def stop
  Delayed::Jobs::Worker.find_server&.stop
  super
end