(ctx context.Context)
| 89 | } |
| 90 | |
| 91 | func (r *poolDBReloader) Reload(ctx context.Context) error { |
| 92 | r.metrics.RecordReloadAttempt() |
| 93 | providers, outcomes, err := BuildProviders(ctx, r.db, r.cfg, r.logger) |
| 94 | if err != nil { |
| 95 | // Keep the previous snapshot in place: dropping all providers |
| 96 | // because the DB read failed would compound the visible failure |
| 97 | // mode beyond the operator's actual misconfiguration. |
| 98 | return xerrors.Errorf("load ai providers from database: %w", err) |
| 99 | } |
| 100 | r.pool.ReplaceProviders(providers) |
| 101 | r.metrics.RecordReloadSuccess(outcomes) |
| 102 | return nil |
| 103 | } |
| 104 | |
| 105 | // BuildProviders loads all ai_providers rows (enabled and disabled), |
| 106 | // attaches keys to enabled rows, and constructs the equivalent |
nothing calls this directly
no test coverage detected