Module: Pitchfork::Info
- Defined in:
- lib/pitchfork/info.rb
Defined Under Namespace
Classes: WeakSet
Class Attribute Summary collapse
-
.workers_count ⇒ Object
Returns the value of attribute workers_count.
Class Method Summary collapse
- .close_all_ios! ⇒ Object
- .fork_safe? ⇒ Boolean
- .keep_io(io) ⇒ Object
- .keep_ios(ios) ⇒ Object
- .live_workers_count ⇒ Object
- .no_longer_fork_safe! ⇒ Object
-
.shutting_down? ⇒ Boolean
Returns true if the server is shutting down.
Class Attribute Details
.workers_count ⇒ Object
Returns the value of attribute workers_count.
88 89 90 |
# File 'lib/pitchfork/info.rb', line 88 def workers_count @workers_count end |
Class Method Details
.close_all_ios! ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/pitchfork/info.rb', line 37 def close_all_ios! raise NoMethodError, " Your Ruby version is subject to a bug that prevent `.close_all_ios!` from working.\n See: https://bugs.ruby-lang.org/issues/19531.\n\n Consider upgrading to Ruby 3.2.3+\n MSG\nend\n" |
.fork_safe? ⇒ Boolean
90 91 92 |
# File 'lib/pitchfork/info.rb', line 90 def fork_safe? @fork_safe end |
.keep_io(io) ⇒ Object
29 30 31 |
# File 'lib/pitchfork/info.rb', line 29 def keep_io(io) io # noop end |
.keep_ios(ios) ⇒ Object
33 34 35 |
# File 'lib/pitchfork/info.rb', line 33 def keep_ios(ios) ios # noop end |
.live_workers_count ⇒ Object
98 99 100 101 102 103 |
# File 'lib/pitchfork/info.rb', line 98 def live_workers_count now = Pitchfork.time_now(true) (0...workers_count).count do |nr| SharedMemory.worker_deadline(nr).value > now end end |
.no_longer_fork_safe! ⇒ Object
94 95 96 |
# File 'lib/pitchfork/info.rb', line 94 def no_longer_fork_safe! @fork_safe = false end |
.shutting_down? ⇒ Boolean
Returns true if the server is shutting down. This can be useful to implement health check endpoints, so they can fail immediately after TERM/QUIT/INT was received by the master process. Otherwise they may succeed while Pitchfork is draining requests causing more requests to be sent.
111 112 113 |
# File 'lib/pitchfork/info.rb', line 111 def shutting_down? SharedMemory.shutting_down? end |