lib/floe/workflow/state.rb in floe-0.4.0 vs lib/floe/workflow/state.rb in floe-0.4.1
- old
+ new
@@ -90,8 +90,25 @@
end
def finished?
context.state.key?("FinishedTime")
end
+
+ private
+
+ def wait(seconds: nil, time: nil)
+ context.state["WaitUntil"] =
+ if seconds
+ (Time.parse(context.state["EnteredTime"]) + seconds).iso8601
+ elsif time.kind_of?(String)
+ time
+ else
+ time.iso8601
+ end
+ end
+
+ def waiting?
+ context.state["WaitUntil"] && Time.now.utc <= Time.parse(context.state["WaitUntil"])
+ end
end
end
end