Description
When you have multiple instances of the same workflow containing Activities the GetPendingActivity method has no way to assosiate this with a specific workflow instance but instead find the first open subscription( created by all the Activity instances) in the repo
Maybe I do not understand this correctly but an activity cannot happen if it is not associated with a workflow instance otherwise this just becomes a random activity.
To illustrate my point:
If you take sample18(approval of spending). If you create two instances of the workflow there is no way to say which one you approve unless you can specify a workflow.
Things will also slow down as the amount of events grow in the repo:
foreach (var eventId in await _eventRepository.GetEvents(sub.EventName, sub.EventKey, sub.SubscribeAsOf))
This line will go through all events in the repo(can become millions) with the same name to see if it must be executed