Sha256: d9e93811aba3c34fc895decba551ab4abba8fec591cc345776f6549b36685b0a
Contents?: true
Size: 1.14 KB
Versions: 17
Compression:
Stored size: 1.14 KB
Contents
require 'ostruct' module Protobuf module Rpc class ZmqRunner include ::Protobuf::Logger::LogMethods def initialize(options) @options = case when options.is_a?(OpenStruct) then options.marshal_dump when options.respond_to?(:to_hash) then options.to_hash else raise "Cannot parser Zmq Server - server options" end end def run @server = ::Protobuf::Rpc::Zmq::Server.new(@options) register_signals @server.run do yield if block_given? end end def running? @server.try :running? end def stop @server.try :stop end private def register_signals trap(:TTIN) do @server.add_worker log_info { "Increased worker size to: #{@server.total_workers}" } end trap(:TTOU) do log_info { "Current worker size: #{@server.workers.size}" } log_info { "Current worker size: #{@server.busy_worker_count}" } end end end end end
Version data entries
17 entries across 17 versions & 2 rubygems