-
-
Save hoverlover/92cd2c843cb9cec45eff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============== timer started | |
timed out! | |
timed_out: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "pry-nav" | |
require 'rufus-json/automatic' | |
require 'ruote' | |
require 'ruote/storage/fs_storage' | |
ruote = Ruote::Dashboard.new( | |
Ruote::Worker.new( | |
Ruote::FsStorage.new('ruote_work'))) | |
ruote.noisy = false | |
class StartTimer < Ruote::Participant | |
def on_workitem | |
puts "============== timer started" | |
end | |
end | |
ruote.register :start_timer, StartTimer | |
pdef = Ruote.define do | |
define "time_it_out" do | |
echo "timed out!" | |
rset "v:/timed_out" => true | |
end | |
# Autonomous participant | |
start_timer forget: true, timers: "2s: time_it_out" | |
# ... continue on with other things | |
# This wait is to give the start_timer time to actually time out | |
wait "5s" | |
# Here is where I would check the timed_out variable, and act accordingly. | |
# I expect this to be true, but is false | |
echo "timed_out: ${v:/timed_out}" | |
end | |
wfid = ruote.launch pdef, {}, { timed_out: false } | |
ruote.wait_for(wfid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Chad,
if there are no answers in the #ruote channel in IRC, feel free to use ruote's mailing-list: http://groups.google.com/group/openwferu-users
Your "time_it_out" process is executing attached to "start_timer" which is forgotten. A forgotten branch/subprocess has no access to its parent subprocess (it might be already gone), so setting /timed_out happens in the root of the "time_it_out" subprocess which is, the "start_timer" expression.
Cheers.