Class: Sidekiq::Restart::Command
- Inherits:
-
Object
- Object
- Sidekiq::Restart::Command
- Defined in:
- lib/sidekiq/restart/command.rb
Instance Method Summary collapse
-
#initialize(sidekiq) ⇒ Command
constructor
A new instance of Command.
- #run(id) ⇒ Object
Constructor Details
#initialize(sidekiq) ⇒ Command
Returns a new instance of Command.
5 6 7 |
# File 'lib/sidekiq/restart/command.rb', line 5 def initialize sidekiq @sidekiq = sidekiq end |
Instance Method Details
#run(id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sidekiq/restart/command.rb', line 9 def run id @sidekiq.redis do |conn| payload = conn.get("worker:#{id}") if payload msg = @sidekiq.load_json(payload)['payload'] Sidekiq::Client.push msg # cleanup redis details about the worker conn.srem("workers", id) conn.del("worker:#{id}") conn.del("worker:#{id}:started") end end end |