feat(updater): update StartModelsUpdater to block until models refresh completes
This commit is contained in:
@@ -42,12 +42,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartModelsUpdater starts a one-time models refresh on startup.
|
// StartModelsUpdater runs a one-time models refresh on startup.
|
||||||
// It attempts to fetch models from network once, then exits.
|
// It blocks until the startup fetch attempt finishes so service initialization
|
||||||
// Safe to call multiple times; only one updater will be started.
|
// 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) {
|
func StartModelsUpdater(ctx context.Context) {
|
||||||
updaterOnce.Do(func() {
|
updaterOnce.Do(func() {
|
||||||
go runModelsUpdater(ctx)
|
runModelsUpdater(ctx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user