workflow-es icon indicating copy to clipboard operation
workflow-es copied to clipboard

Workflow never resumed after waitFor

Open huksley opened this issue 5 years ago • 1 comments

Workflow never resumed after waitFor Based on an example in https://github.com/danielgerlag/workflow-es/blob/master/samples/node.js/typescript/04-events.ts

Node v12.11.1 Typescript: 3.5.1 workflow-es: "^2.3.5" Source code: https://github.com/huksley/workflow-runner

Reproducing:

yarn install
yarn build
node build/src/main.js

This results in hanging because invoking publishEvent does not result in resuming the execution, here are the log:

Started workflow: d63f961b0d715
LogMessage: Waiting for event... d63f961b0d715
Pinging d63f961b0d715
Got ping, sending event
<node hangs here...>

huksley avatar Mar 16 '20 22:03 huksley

I found the "apparent" reason for this, here are the log

Publishing event myEvent 0
Dequeued workflow 94377702c459e for processing
Execute workflow: 94377702c459e
Dequeued event da0202c40a8c5 for processing
DEBUG: myEvent 0 2020-03-19T17:07:38.554Z
[
  EventSubscription {
    workflowId: '94377702c459e',
    stepId: 2,
    eventName: 'myEvent',
    eventKey: '0',
    subscribeAsOf: 2020-03-19T17:07:38.657Z,
    id: '9398d6f013f9'
  }
]

The event generated essentially has a date which is earlier than the date for a subscription (however I don't specify a date for waitFor, but it generates an eventDate none the less)

Could you clarify this @danielgerlag that is the intended design here? I am going to make a PR for this

huksley avatar Mar 19 '20 17:03 huksley