From e333fbea3da4fa8878a50234231c271446e9ff1f Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:41:58 +0800 Subject: [PATCH] feat(updater): update StartModelsUpdater to block until models refresh completes --- internal/registry/model_updater.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/registry/model_updater.go b/internal/registry/model_updater.go index f0517df6..84c9d6aa 100644 --- a/internal/registry/model_updater.go +++ b/internal/registry/model_updater.go @@ -42,12 +42,13 @@ func init() { } } -// StartModelsUpdater starts a one-time models refresh on startup. -// It attempts to fetch models from network once, then exits. -// Safe to call multiple times; only one updater will be started. +// StartModelsUpdater runs a one-time models refresh on startup. +// It blocks until the startup fetch attempt finishes so service initialization +// can wait for the refreshed catalog before registering auth-backed models. +// Safe to call multiple times; only one refresh will run. func StartModelsUpdater(ctx context.Context) { updaterOnce.Do(func() { - go runModelsUpdater(ctx) + runModelsUpdater(ctx) }) }