Azure / azure-functions-durable-js

JavaScript library for using the Durable Functions bindings
https://www.npmjs.com/package/durable-functions
MIT License
129 stars 47 forks source link

Move the `taskOrchestrationExecutor` from RetryableTask constructor to `trySetValue()` #534

Closed hossam-nasr closed 1 year ago

hossam-nasr commented 1 year ago

This doesn't change any functionality of the RetryableTask. Rather, this means that a TaskOrchestrationExecutor is not required in the constructor for RetryableTask, but can be passed as in argument when it's really needed: in the trySetValue() function. This means that a RetryableTask can be constructed outside the context of a DurableOrchestrationContext (where the TaskOrchestrationExecutor is available), unblocking #418

The reason all these changes are required is because this is the new flow of the TaskOrchestrationExecutor:

TaskOrchestrationExecutor.execute() calls TaskBase.setValue() with a reference of itself -> TaskBase.setValue() calls TaskBase.propagate() -> calls CompoundTask.handleCompletion() -> calls CompoundTask.trySetValue()