Module: Pitchfork::Info

Defined in:
lib/pitchfork/info.rb

Defined Under Namespace

Classes: WeakSet

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.workers_countObject

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

Raises:

  • (NoMethodError)


37
38
39
40
41
42
43
44
# File 'lib/pitchfork/info.rb', line 37

def close_all_ios!
  raise NoMethodError, <<~MSG
    Your Ruby version is subject to a bug that prevent `.close_all_ios!` from working.
    See: https://bugs.ruby-lang.org/issues/19531.

    Consider upgrading to Ruby 3.2.3+
  MSG
end

.fork_safe?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/pitchfork/info.rb', line 90

def fork_safe?
  @fork_safe
end

.keep_io(io) ⇒ Object

Raises:

  • (ArgumentError)


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_countObject



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.

Returns:

  • (Boolean)


111
112
113
# File 'lib/pitchfork/info.rb', line 111

def shutting_down?
  SharedMemory.shutting_down?
end