mirror of
https://github.com/corda/corda.git
synced 2025-06-19 23:53:52 +00:00
CORDA-1494: Remove isTimed check from flow hospital when handling tim… (#3337)
* CORDA-1494: Remove isTimed check from flow hospital when handling timeout exceptions - the timeout might expire just after the TimeFlow has finished and the staff member would throw an exception. Increase the default flow timeout value in mock network so retries don't happen – this has cause test flakiness.
This commit is contained in:
@ -2,7 +2,6 @@ package net.corda.node.services.statemachine
|
||||
|
||||
import net.corda.core.flows.StateMachineRunId
|
||||
import net.corda.core.internal.ThreadBox
|
||||
import net.corda.core.internal.TimedFlow
|
||||
import net.corda.core.internal.bufferUntilSubscribed
|
||||
import net.corda.core.messaging.DataFeed
|
||||
import net.corda.core.utilities.contextLogger
|
||||
@ -204,24 +203,14 @@ class StaffedFlowHospital {
|
||||
object DoctorTimeout : Staff {
|
||||
override fun consult(flowFiber: FlowFiber, currentState: StateMachineState, newError: Throwable, history: MedicalHistory): Diagnosis {
|
||||
if (newError is FlowTimeoutException) {
|
||||
if (isTimedFlow(flowFiber)) {
|
||||
if (history.notDischargedForTheSameThingMoreThan(newError.maxRetries, this)) {
|
||||
return Diagnosis.DISCHARGE
|
||||
} else {
|
||||
log.warn("\"Maximum number of retries reached for timed flow ${flowFiber.javaClass}")
|
||||
}
|
||||
if (history.notDischargedForTheSameThingMoreThan(newError.maxRetries, this)) {
|
||||
return Diagnosis.DISCHARGE
|
||||
} else {
|
||||
log.warn("\"Unable to restart flow: ${flowFiber.javaClass}, it is not timed and does not contain any timed sub-flows.")
|
||||
log.warn("\"Maximum number of retries reached for timed flow ${flowFiber.javaClass}")
|
||||
}
|
||||
}
|
||||
return Diagnosis.NOT_MY_SPECIALTY
|
||||
}
|
||||
|
||||
private fun isTimedFlow(flowFiber: FlowFiber): Boolean {
|
||||
return flowFiber.snapshot().checkpoint.subFlowStack.any {
|
||||
TimedFlow::class.java.isAssignableFrom(it.flowClass)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user