Sha256: 6e4f598b8300d7b319e5c17ea253158c8802fa5099997ddfda872c4daa95a638

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

# -*- encoding: binary -*-
# :enddoc:
# This class handles the Unicorn fchmod heartbeat mechanism
# in Coolio-based concurrency models to prevent the master
# process from killing us unless we're blocked.  This class
# will also detect and execute the graceful exit if triggered
# by SIGQUIT
class Rainbows::Coolio::Heartbeat < Coolio::TimerWatcher
  KATO = Rainbows::Coolio::KATO
  CONN = Rainbows::Coolio::CONN
  Rainbows.config!(self, :keepalive_timeout)

  def on_timer
    if (ot = KEEPALIVE_TIMEOUT) >= 0
      ot = Time.now - ot
      KATO.delete_if { |client, time| time < ot and client.timeout? }
    end
    exit if (! Rainbows.tick && CONN.size <= 0)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainbows-3.3.0 lib/rainbows/coolio/heartbeat.rb