File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ def self.exists?(worker_id)
7878 redis . sismember ( :workers , worker_id )
7979 end
8080
81+ attr_accessor :id
82+
8183 # Workers should be initialized with an array of string queue
8284 # names. The order is important: a Worker will check the first
8385 # queue given for a job. If none is found, it will check the
@@ -90,10 +92,10 @@ def self.exists?(worker_id)
9092 # in alphabetical order. Queues can be dynamically added or
9193 # removed without needing to restart workers using this method.
9294 def initialize ( queues )
93- @queues = [ queues ] . flatten . map { |queue | queue . to_s . strip }
95+ @queues = [ queues ] . flatten . map { |queue | queue . to_s . strip }
9496 @shutdown = nil
95- @paused = nil
96- @id = nil
97+ @paused = nil
98+ @id = " #{ hostname } : #{ pid } : #{ @queues . join ( ',' ) } "
9799 end
98100
99101 # This is the main workhorse method. Called on a Worker instance,
@@ -519,18 +521,6 @@ def ==(other)
519521 id == other . id
520522 end
521523
522- def inspect
523- "#<Worker #{ id } >"
524- end
525-
526- attr_writer :id
527-
528- # The string representation is the same as the id for this worker
529- # instance. Can be used with `Worker.find`.
530- def id
531- @id ||= "#{ hostname } :#{ Process . pid } :#{ @queues . join ( ',' ) } "
532- end
533-
534524 def hostname
535525 Socket . gethostname
536526 end
You can’t perform that action at this time.
0 commit comments