Sha256: 81a0378f321902e3c530146aaebd6e48d4ab1388d5fc8bf8e15b7b046a8e99b4

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

# frozen_string_literal: true

module Griffin
  module Engine
    module Worker
      def initialize
        @socket_manager = ServerEngine::SocketManager::Client.new(server.socket_manager_path)
      end

      def before_fork
        server.core.before_run(worker_id)
      end

      def run
        @lsock = @socket_manager.listen_tcp(config[:bind], config[:port])
        @lsock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
        server.core.run(@lsock)
      ensure
        @lsock.close if @lsock
      end

      def stop
        server.core.shutdown
      end

      # def after_fork; end
      # def reload; end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
griffin-0.2.2 lib/griffin/engine/worker.rb
griffin-0.2.1 lib/griffin/engine/worker.rb