lib/dynflow/dispatcher/client_dispatcher.rb in dynflow-0.8.16 vs lib/dynflow/dispatcher/client_dispatcher.rb in dynflow-0.8.17
- old
+ new
@@ -50,19 +50,19 @@
finish_termination
end
def dispatch_request(request, client_world_id, request_id)
executor_id = match request,
- (on ~Execution do |execution|
- AnyExecutor
- end),
- (on ~Event do |event|
- find_executor(event.execution_plan_id)
- end),
- (on Ping.(~any) do |receiver_id|
- receiver_id
- end)
+ (on ~Execution do |execution|
+ AnyExecutor
+ end),
+ (on ~Event do |event|
+ find_executor(event.execution_plan_id)
+ end),
+ (on Ping.(~any) do |receiver_id|
+ receiver_id
+ end)
envelope = Envelope[request_id, client_world_id, executor_id, request]
if Dispatcher::UnknownWorld === envelope.receiver_id
raise Dynflow::Error, "Could not find an executor for #{envelope}"
end
connector.send(envelope).value!
@@ -72,19 +72,19 @@
end
def dispatch_response(envelope)
return unless @tracked_requests.key?(envelope.request_id)
match envelope.message,
- (on ~Accepted do
- @tracked_requests[envelope.request_id].accept!
- end),
- (on ~Failed do |msg|
- resolve_tracked_request(envelope.request_id, Dynflow::Error.new(msg.error))
- end),
- (on Done | Pong do
- resolve_tracked_request(envelope.request_id)
- end)
+ (on ~Accepted do
+ @tracked_requests[envelope.request_id].accept!
+ end),
+ (on ~Failed do |msg|
+ resolve_tracked_request(envelope.request_id, Dynflow::Error.new(msg.error))
+ end),
+ (on Done | Pong do
+ resolve_tracked_request(envelope.request_id)
+ end)
end
private
def find_executor(execution_plan_id)
@@ -126,15 +126,15 @@
if error
@tracked_requests.delete(id).fail! error
else
tracked_request = @tracked_requests[id]
resolve_to = match tracked_request.request,
- (on Execution.(execution_plan_id: ~any) do |uuid|
- @world.persistence.load_execution_plan(uuid)
- end),
- (on Event | Ping do
- true
- end)
+ (on Execution.(execution_plan_id: ~any) do |uuid|
+ @world.persistence.load_execution_plan(uuid)
+ end),
+ (on Event | Ping do
+ true
+ end)
@tracked_requests.delete(id).success! resolve_to
end
end
end