sclasen / swfsm

[golang] simple workflow finite state machines
MIT License
53 stars 14 forks source link

Add FindAll FilterStatusOpenPriorityWorkflow and Walker #198

Closed ryanbrainard closed 6 years ago

ryanbrainard commented 6 years ago

This adds a new FilterStatusOpenPriorityWorkflow mode to FindAll that first finds all open workflows and then finds all closed workflows, but de-dupes the workflows based on their workflow id. The use case of this is for finding workflows that were recently continued, so they may not be on the open list, but should be on the closed list. These list calls are eventually consistent, so this is not perfect, but it's "more perfect" then what we have. I filed an AWS ticket about this and they agreed this would be the best course of action. See https://github.com/heroku/dogwood/issues/1577 for details.

Note, FilterStatusOpenPriorityWorkflow is different from FilterStatusOpenPriority, which doesn't even fetch the closed workflows at all if any workflow is returned in the open list. FilterStatusOpenPriorityWorkflow always calls both, but then de-dupes and prefers the already-fetched (i.e. open) workflows.

This also adds a FindAllWalk function to find all and walk with a function on the workflows.

ryanbrainard commented 6 years ago

Once this is merged, all uses of WalkOpenWorkflowInfos need to be replaced with FindAllWalk. Luckily, there aren't that many of them (3 I think in heroku/dogwood).

ryanbrainard commented 6 years ago

@sclasen Can you give this a look when you get a minute?

sclasen commented 6 years ago

:+1:

ryanbrainard commented 6 years ago

Holding off merging this until I get this all working in dogwood and swfsmx. PR's incoming for those two shortly.