lib/floe/workflow/states/wait.rb in floe-0.3.1 vs lib/floe/workflow/states/wait.rb in floe-0.4.0

- old
+ new

@@ -15,18 +15,25 @@ @input_path = Path.new(payload.fetch("InputPath", "$")) @output_path = Path.new(payload.fetch("OutputPath", "$")) end - def run!(input) + def start(input) + super input = input_path.value(context, input) - sleep(seconds) - output = output_path.value(context, input) - [@end ? nil : @next, output] + + context.output = output_path.value(context, input) + context.next_state = end? ? nil : @next end - def status - @end ? "success" : "running" + def running? + now = Time.now.utc + if now > (Time.parse(context.state["EnteredTime"]) + @seconds) + context.state["FinishedTime"] = now.iso8601 + false + else + true + end end def end? @end end