Class: Protocol::HTTP::Executor::Generic

Inherits:
Middleware
  • Object
show all
Defined in:
lib/protocol/http/executor/generic.rb

Overview

The common middleware implementation for isolated execution contexts.

Direct Known Subclasses

Ractored, Threaded

Instance Method Summary collapse

Instance Method Details

#call(request) ⇒ Object

Execute a request using a new isolated execution context.



18
19
20
21
22
23
24
25
26
27
# File 'lib/protocol/http/executor/generic.rb', line 18

def call(request)
	parent = ::Async::Task.current
	endpoint, worker_streams = Transport.pair
	backend = spawn(worker_streams)
	
	Execution.new(endpoint, backend, request, parent).call
rescue
	endpoint&.close
	raise
end