Sha256: 396d246e35a241151e4c3477b4b3be9ede86a146b68a2bb89f8d74b4c654c4d4
Contents?: true
Size: 887 Bytes
Versions: 2
Compression:
Stored size: 887 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 Zapp.config.app.prepare if Zapp.config.app.respond_to?(:prepare) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zapp-0.2.6 | lib/zapp/worker.rb |
zapp-0.2.5 | lib/zapp/worker.rb |