Sha256: ee6d049f9cf76dba6636166b78014882aab5ae1a5d83ab969451e8bc2e1867dd
Contents?: true
Size: 924 Bytes
Versions: 2
Compression:
Stored size: 924 Bytes
Contents
module Sidetiq module Actor def self.included(base) base.__send__(:include, Celluloid) base.finalizer :sidetiq_finalizer end def initialize(*args, &block) log_call "initialize" super # Link to Sidekiq::Manager when running in server-mode. In most # cases the supervisor is booted before Sidekiq has launched # fully, so defer this. if Sidekiq.server? after(0.1) { link_to_sidekiq_manager } end end private def sidetiq_finalizer log_call "shutting down ..." end def link_to_sidekiq_manager Sidekiq::CLI.instance.launcher.manager.link(current_actor) rescue NoMethodError warn "Can't link #{self.class.name}. Sidekiq::Manager not running. Retrying ..." after(1) { link_to_sidekiq_manager } end def log_call(call) info "#{self.class.name} id: #{object_id} #{call}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidetiq-0.4.0.rc2 | lib/sidetiq/actor.rb |
sidetiq-0.4.0.rc1 | lib/sidetiq/actor.rb |