(
sessionId: string,
projectionCache: RuntimeReadModelProjectionCache = this.deps.store,
)
| 5404 | } |
| 5405 | |
| 5406 | private async getSessionView( |
| 5407 | sessionId: string, |
| 5408 | projectionCache: RuntimeReadModelProjectionCache = this.deps.store, |
| 5409 | ): Promise<RuntimeReadModelSessionView> { |
| 5410 | const repaired = new Set<string>(); |
| 5411 | for (let attempt = 0; attempt < MAX_RUNTIME_LEDGER_REPAIR_ATTEMPTS; attempt += 1) { |
| 5412 | try { |
| 5413 | const view = await this.readModel(projectionCache).getSessionView(sessionId); |
| 5414 | const runId = firstRuntimeRepairRunId(view.diagnostics, repaired); |
| 5415 | if (!runId) return view; |
| 5416 | if (!(await this.repairMissingTerminalFactOnce(sessionId, runId))) return view; |
| 5417 | repaired.add(runId); |
| 5418 | } catch (error) { |
| 5419 | if (!(error instanceof RuntimeReadModelError)) throw error; |
| 5420 | const runId = firstRuntimeRepairRunId(error.diagnostics, repaired); |
| 5421 | if (!runId) throw error; |
| 5422 | if (!(await this.repairMissingTerminalFactOnce(sessionId, runId))) throw error; |
| 5423 | repaired.add(runId); |
| 5424 | } |
| 5425 | } |
| 5426 | return this.readModel(projectionCache).getSessionView(sessionId); |
| 5427 | } |
| 5428 | |
| 5429 | private readModel( |
| 5430 | projectionCache: RuntimeReadModelProjectionCache = this.deps.store, |
no test coverage detected