Sha256: 4dacd81be5764a595070099844a11e22e0212899e3490db39081510daeab2644
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 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 yield if block_given? @server.run end def running? @server.try :running? end def stop @server.try :stop end private def register_signals trap(:TTIN) do log_info { "TTIN received: Starting new worker" } @server.start_worker log_info { "Worker count : #{::Protobuf::Rpc::Zmq::Server.threads.size}" } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems