Class: Zapp::Worker
- Inherits:
-
Ractor
- Object
- Ractor
- Zapp::Worker
- Defined in:
- lib/zapp/worker.rb,
lib/zapp/worker/request_processor.rb
Overview
One worker processing requests in parallel
Defined Under Namespace
Classes: RequestProcessor
Class Method Summary collapse
-
.name(index) ⇒ Object
Index based name of the worker.
- .new(context_pipe:, socket_pipe:, index:) ⇒ Object
Instance Method Summary collapse
Class Method Details
.name(index) ⇒ Object
Index based name of the worker
30 31 32 |
# File 'lib/zapp/worker.rb', line 30 def name(index) "zapp-http-#{index + 1}" end |
.new(context_pipe:, socket_pipe:, index:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/zapp/worker.rb', line 9 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 |
Instance Method Details
#terminate ⇒ Object
35 36 37 |
# File 'lib/zapp/worker.rb', line 35 def terminate take end |