Sha256: efd42b8642929a9f0afc3a0e90b1febb8006a622e5763db46796e71f07fcfb92
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
# frozen_string_literal: true require_relative("worker/request_processor") module Zapp # One worker processing requests in parallel class Worker < Ractor class << self def new(context_pipe:, socket_pipe:, index:) super( context_pipe, socket_pipe, Zapp.config.dup, name: name(index) ) do |context_pipe, socket_pipe, config| Ractor.current[Zapp::RACTOR_CONFIG_KEY] = config processor = Zapp::Worker::RequestProcessor.new( socket_pipe: socket_pipe, context_pipe: context_pipe ) processor.loop end end # Index based name of the worker def name(index) "zapp-http-#{index + 1}" end end def terminate take end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zapp-0.2.4 | lib/zapp/worker.rb |
zapp-0.2.3 | lib/zapp/worker.rb |
zapp-0.2.2 | lib/zapp/worker.rb |