Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a callback to the outcall that will get called when each evocatio…

…n is theoretically ready.
  • Loading branch information...
commit 289dae96da4387c5a3dd51c5dd4cbc81b10a707e 1 parent d2f97d8
Samuel Tesla authored
Showing with 7 additions and 2 deletions.
  1. +2 −1  lib/pelvis/evocation.rb
  2. +5 −1 lib/pelvis/outcall.rb
View
3  lib/pelvis/evocation.rb
@@ -3,7 +3,7 @@ class Evocation
include Logging
extend Callbacks
- callbacks :received, :completed, :failed
+ callbacks :received, :completed, :failed, :begun
def initialize(outcall, identity)
@outcall, @identity = outcall, identity
@@ -44,6 +44,7 @@ def start
def reply
if @initialized && @begun
@incall.begin
+ begun
end
end
View
6 lib/pelvis/outcall.rb
@@ -3,7 +3,7 @@ class Outcall
include Logging
extend Callbacks
- callbacks :received, :completed, :failed
+ callbacks :received, :completed, :failed, :evoked
def initialize(agent, job)
@agent, @job = agent, job
@@ -62,6 +62,10 @@ def evoke_to(identities)
def evoke(identity)
e = Evocation.start(self, identity)
evocations[e] = false
+ e.on_begun do
+ logger.debug "outcall begun: #{identity}"
+ evoked
+ end
e.on_received do |data|
logger.debug "outcall received: #{identity}: #{data.inspect}"
received(data)
Please sign in to comment.
Something went wrong with that request. Please try again.