Sha256: 8eb6926db59e46775416ff7a5c84e1470dba9b57324db04ebf43f554763a0b6e

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

class Navy::Captain::Orders < Navy::Orders

  defaults.merge!({
    after_fork: ->(captain, officer) do
      captain.logger.info("(#{captain.label}) officer=#{officer.number} spawned pid=#{$$}")
    end,
    after_stop: ->(captain, graceful) do
      captain.logger.debug("captain=#{captain.label} after (#{graceful ? 'graceful' : 'hard'}) stop") if $DEBUG
    end,
    before_fork: ->(captain, officer) do
      captain.logger.info("(#{captain.label}) officer=#{officer.number} spawning...")
    end,
    before_stop: ->(captain, graceful) do
      captain.logger.debug("captain=#{captain.label} before (#{graceful ? 'graceful' : 'hard'}) stop") if $DEBUG
    end,
    heartbeat: ->(captain) do
      captain.logger.debug("captain=#{captain.label} heartbeat") if $DEBUG
    end,
    officer_job: -> { trap(:QUIT) { exit }; trap(:TERM) { exit }; loop { sleep 1 } },
    officer_count: 0,
    officer_fire_and_forget: false,
    patience: 30,
    post_fork: ->(captain, officer) do
      captain.logger.debug("(#{captain.label}) officer=#{officer.number} post-fork") if $DEBUG
    end,
    preload: ->(captain) do
      captain.logger.info("captain=#{captain.label} preloading...")
    end,
    respawn_limit: 100,
    respawn_limit_seconds: 1.0,
    timeout: 30
  })

end
require 'navy/captain/speak'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
navy-1.1.2 lib/navy/captain/orders.rb