| 1 | package main |
| 2 | |
| 3 | import "reasonix/internal/event" |
| 4 | |
| 5 | // persistMetricsEvent snapshots controller-owned recovery counters after |
| 6 | // display persistence has acknowledged the final projection. |
| 7 | func persistMetricsEvent(app *App, metrics *metricsAggregator, tabID string, e event.Event) { |
| 8 | if !metricsEventRequiresPersist(e) { |
| 9 | return |
| 10 | } |
| 11 | if e.Kind == event.TurnDone { |
| 12 | if tab := app.tabByID(tabID); tab != nil && tab.Ctrl != nil { |
| 13 | observeControllerRecoveryMetrics(metrics, tab.Ctrl) |
| 14 | observeControllerTurnEventMetrics(metrics, tab.Ctrl) |
| 15 | } |
| 16 | } |
| 17 | metrics.persist() |
| 18 | } |
| 19 |