amazon-archives / aws-flow-ruby

ARCHIVED
136 stars 57 forks source link

Timer fires but no logic run after until workflow times out or exceeds event limit #113

Open mustafashabib opened 8 years ago

mustafashabib commented 8 years ago

made an example repo: https://github.com/mustafashabib/aws-flow-timer-tests

Playing around with Timers

Seeing weird behavior when you set a timer, it fires, and you have additional code to run (especially calling an activity via an activity client) from within a method body.

It mostly doesn't work in my tests, but occassionally does work.

This is super confusing.

When it fails, I see the timer fire properly but the subsequent next line of code never runs - I know this because it is an activity call and I see no call scheduled.

Instead, the SWF workflow sits there and decision tasks get scheduled and timed out until either the EVENT LIMIT for the workflow is met and the workflow terminated or if the workflow timeout is exceeded and the workflow is again terminated.

What seems To Always Work

Unrolling all the logic out of workflow methods and putting them into the main body of the workflow entry point method seems to always work. I tested this by starting several concurrent workflows while running this code and all were completed successfully as expected.

When I move the create_timer call and client.echo('something') calls to a method body such as def schedule_timer_and_echo_via_client() then call that method from the main workflow method, it sometimes works but mostly does not.

mustafashabib commented 8 years ago

Just an update - even moving the timer code into the main workflow method doesn't solve this issue.

Is this because my call to create_timer does not provide a do block?

We just want the timers to get created and to wait until they fire before moving forward in the workflow. We had implemented this as create_timer_async calls with do blocks and a wait_for_all call but saw the exact same behavior.