danielgerlag / workflow-core

Lightweight workflow engine for .NET Standard
MIT License
5.31k stars 1.19k forks source link

Delete Workflow Through IWorkflowRepository #792

Open matthew-kump opened 3 years ago

matthew-kump commented 3 years ago

We are reading the workflow from the persistence provider after the workflow completes. The IWorkflowRepository provides APIs to get the workflow but no API to delete the workflow. I see there is an IWorkflowPurger but only with an API to purge workflows based on datetime.

If the IWorkflowRepository can have an additional API to delete based on the workflow Id it would make cleaning up workflows a little easier after they complete.

danielgerlag commented 3 years ago

How do you determine which workflows to delete and when to delete them?

matthew-kump commented 3 years ago

We are running in a cluster environment and listening to the events coming back. So when the workflow completed event is triggered we read the workflow from the persistence to get its data. After reading from persistence we would then like to delete this workflow using its Id and no need to keep it around for long periods of time.

danielgerlag commented 3 years ago

We could implement that, but we'd need to do it for every persistence provider, there are 8 of them :)

diegosasw commented 7 months ago

Right now workflow persistence is not automatically deleted at the end of the workflow? Why would an ended workflow need to keep data?

PS: I found there is a purge method https://github.com/danielgerlag/workflow-core/issues/368 Any chance to auto-purge when workflow completed?

cjundt commented 7 months ago

Traceability ?!