waitForExternalEvent not completing in reasonable time when event arrives early #558
Labels
P2
Priority 2 item
programming model 🚀
Reliability
Durable functions get stuck or don’t run as expected.
Describe the bug
context.df.waitForExternalEvent() in context.df.Task.any() does not complete quickly in case the event arrives too early or in some cases seemingly at all.
We have a system where durable orchestrator calls activity function which calls external service which starts some processes one of which will send the event trough httpTrigger but in case the external server and the activity function return later than the started process triggers the event we are seeing long waits for waitForExternalEvent in the orchestrator. With durable-functions npm module version 1.5.4 same code completes instantly but with versions 2 and later the event does not trigger correctly.
Investigative information
To Reproduce
Have orchestrator which waits for event and calls activity function where the activity function triggers the event, see sample code for example.
Orchestrator source code (minimal example):
index.ts
Activity function source code (minimal example):
index.ts
In the sample code the context.df.Task.any() seemingly completes when timeout task completes but the waitForExternalEvent task wins since it received event long before. Modify duration of deadline task to see it changing when waitForExternalEvent completes, or remove the deadline task from the Task.any and code seemingly never completes
Expected behavior
context.df.waitForExternalEvent() in context.df.Task.any() completes quickly when waitForExternalEvent has received the event.
Actual behavior
context.df.waitForExternalEvent() in context.df.Task.any() completes when other task in Task.any() completes or in case there is not other task seemingly never.
Additional context
The text was updated successfully, but these errors were encountered: