Class: Sidekiq::Process
- Inherits:
-
Object
- Object
- Sidekiq::Process
- Defined in:
- lib/sidekiq/api.rb
Overview
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>,
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#dump_threads ⇒ Object
Signal this process to log backtraces for all threads.
- #identity ⇒ Object
- #labels ⇒ Object
- #queues ⇒ Object
-
#quiet! ⇒ Object
Signal this process to stop processing new jobs.
-
#stop! ⇒ Object
Signal this process to shutdown.
-
#stopping? ⇒ Boolean
True if this process is quiet or shutting down.
- #tag ⇒ Object
Instance Method Details
#[](key) ⇒ Object
958 959 960 |
# File 'lib/sidekiq/api.rb', line 958 def [](key) @attribs[key] end |
#dump_threads ⇒ Object
Signal this process to log backtraces for all threads. Useful if you have a frozen or deadlocked process which is still sending a heartbeat. This method is asynchronous and it can take 5-10 seconds.
990 991 992 |
# File 'lib/sidekiq/api.rb', line 990 def dump_threads signal("TTIN") end |
#identity ⇒ Object
962 963 964 |
# File 'lib/sidekiq/api.rb', line 962 def identity self["identity"] end |
#labels ⇒ Object
954 955 956 |
# File 'lib/sidekiq/api.rb', line 954 def labels self["labels"].to_a end |
#queues ⇒ Object
966 967 968 |
# File 'lib/sidekiq/api.rb', line 966 def queues self["queues"] end |
#quiet! ⇒ Object
Signal this process to stop processing new jobs. It will continue to execute jobs it has already fetched. This method is asynchronous and it can take 5-10 seconds for the process to quiet.
974 975 976 |
# File 'lib/sidekiq/api.rb', line 974 def quiet! signal("TSTP") end |
#stop! ⇒ Object
Signal this process to shutdown. It will shutdown within its configured :timeout value, default 25 seconds. This method is asynchronous and it can take 5-10 seconds for the process to start shutting down.
982 983 984 |
# File 'lib/sidekiq/api.rb', line 982 def stop! signal("TERM") end |
#stopping? ⇒ Boolean
Returns true if this process is quiet or shutting down.
995 996 997 |
# File 'lib/sidekiq/api.rb', line 995 def stopping? self["quiet"] == "true" end |
#tag ⇒ Object
950 951 952 |
# File 'lib/sidekiq/api.rb', line 950 def tag self["tag"] end |