class Sidekiq::Process
Sidekiq::Process
represents an active Sidekiq
process talking with Redis. Each process has a set of attributes which look like this:
{
'hostname' => 'app-1.example.com', 'started_at' => <process start time>, 'pid' => 12345, 'tag' => 'myapp' 'concurrency' => 25, 'queues' => ['default', 'low'], 'busy' => 10, 'beat' => <last heartbeat>, 'identity' => <unique string identifying the process>,
}
Public Class Methods
new(hash)
click to toggle source
# File lib/sidekiq/api.rb, line 878 def initialize(hash) @attribs = hash end
Public Instance Methods
[](key)
click to toggle source
# File lib/sidekiq/api.rb, line 890 def [](key) @attribs[key] end
dump_threads()
click to toggle source
# File lib/sidekiq/api.rb, line 910 def dump_threads signal("TTIN") end
identity()
click to toggle source
# File lib/sidekiq/api.rb, line 894 def identity self["identity"] end
labels()
click to toggle source
# File lib/sidekiq/api.rb, line 886 def labels Array(self["labels"]) end
queues()
click to toggle source
# File lib/sidekiq/api.rb, line 898 def queues self["queues"] end
quiet!()
click to toggle source
# File lib/sidekiq/api.rb, line 902 def quiet! signal("TSTP") end
stop!()
click to toggle source
# File lib/sidekiq/api.rb, line 906 def stop! signal("TERM") end
stopping?()
click to toggle source
# File lib/sidekiq/api.rb, line 914 def stopping? self["quiet"] == "true" end
tag()
click to toggle source
# File lib/sidekiq/api.rb, line 882 def tag self["tag"] end
Private Instance Methods
signal(sig)
click to toggle source
# File lib/sidekiq/api.rb, line 920 def signal(sig) key = "#{identity}-signals" Sidekiq.redis do |c| c.multi do c.lpush(key, sig) c.expire(key, 60) end end end