Class: Chutzen::Signal

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/chutzen/signal.rb

Overview

Sidekiq worker to accept operational signals and commands through the queue.

Instance Method Summary collapse

Instance Method Details

#perform(signal, expires_at = nil) ⇒ Object

Send a signal to the Chutzen process.

Signal names

  • stop stops the current process from accepting new jobs

Parameters:

  • signal (string)

    the signal you want to send

  • expires_at (integer) (defaults to: nil)

    ignore signal after this time (in seconds since 1970)



22
23
24
25
26
27
28
# File 'lib/chutzen/signal.rb', line 22

def perform(signal, expires_at = nil)
  if fresh?(expires_at)
    perform_signal(signal)
  else
    Sidekiq.logger.info("Ignoring signal `#{signal}' because it expired at #{expires_at}.")
  end
end