danielgmyers / flux-swf-client

Apache License 2.0
9 stars 3 forks source link

Support "minimum workflow run time" attribute on workflows #114

Open danielgmyers opened 4 months ago

danielgmyers commented 4 months ago

There are use cases where a workflow shouldn't be run too frequently, e.g. "don't run this more than every 5 minutes". Assuming the user chooses a consistent workflow identifier across runs, Flux will handle SWF's WorkflowExecutionAlreadyStartedException cleanly.

However, if the previous execution of the workflow is already finished, SWF will start a new execution. This means if users want to enforce a minimum time between workflows, they have to:

Conveniently, Flux already has this functionality internally, but it's only used for @Periodic workflows. We should add a property, probably to the @Workflow annotation, specifying the minimum workflow run time, and use that to set a _delayExit timer for non-@Periodic workflows.