Merge pull request #445 from corda/aslemmer-fix-added-sm-event

Only emit SM Add events when the flow signals that it started
This commit is contained in:
Andras Slemmer 2018-03-05 10:45:10 +00:00 committed by GitHub
commit 7c459f3c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

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

View File

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