Slide 59
Slide 59 text
処理フローが、そのまま suspend fun に
suspend fun switch(...): SwitchResult {
val from = beginSwitch(to, userId, reason, remoteIp) // Tx1
val recordEnabled = to == Phase.DISASTER
val recordSucceeded = retryUnit {
mediaMtx.setRecording(LIVE_PATH_PATTERN, recordEnabled)
}
if (!recordSucceeded) {
rollback(from = to, to = from, userId = userId) // Tx2
throw AppException.mediaServerError()
// 502
}
...
}
設計書の 1→2→3 が、上から順にコードになる