Only emit SM Add events when the flow signals that it started

This commit is contained in:
Andras Slemmer 2018-02-02 17:00:37 +00:00
parent 81801d4566
commit 7a9ce48996
2 changed files with 6 additions and 2 deletions

View File

@ -265,6 +265,9 @@ class MultiThreadedStateMachineManager(
override fun signalFlowHasStarted(flowId: StateMachineRunId) {
concurrentBox.concurrent {
startedFutures.remove(flowId)?.set(Unit)
flows[flowId]?.let { flow ->
changesPublisher.onNext(StateMachineManager.Change.Add(flow.fiber.logic))
}
}
}
@ -571,7 +574,6 @@ class MultiThreadedStateMachineManager(
Fiber.unparkDeserialized(flow.fiber, scheduler)
}
}
changesPublisher.onNext(StateMachineManager.Change.Add(flow.fiber.logic))
}
}

View File

@ -264,6 +264,9 @@ class SingleThreadedStateMachineManager(
override fun signalFlowHasStarted(flowId: StateMachineRunId) {
mutex.locked {
startedFutures.remove(flowId)?.set(Unit)
flows[flowId]?.let { flow ->
changesPublisher.onNext(StateMachineManager.Change.Add(flow.fiber.logic))
}
}
}
@ -574,7 +577,6 @@ class SingleThreadedStateMachineManager(
Fiber.unparkDeserialized(flow.fiber, scheduler)
}
}
changesPublisher.onNext(StateMachineManager.Change.Add(flow.fiber.logic))
}
}
}