mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-12-06 14:26:22 +00:00
Better registry handling
This commit is contained in:
parent
456c165814
commit
66b6a0d835
@ -29,7 +29,23 @@ func NewModelRegistry() *DefaultModelRegistry {
|
||||
}
|
||||
|
||||
func SetDefaultRegistry(registry *DefaultModelRegistry) {
|
||||
registriesMutex.Lock()
|
||||
foundAt := -1
|
||||
for idx, r := range registries {
|
||||
if r == defaultRegistry {
|
||||
foundAt = idx
|
||||
break
|
||||
}
|
||||
}
|
||||
defaultRegistry = registry
|
||||
if foundAt >= 0 {
|
||||
registries[foundAt] = registry
|
||||
} else {
|
||||
registries = append([]*DefaultModelRegistry{registry}, registries...)
|
||||
}
|
||||
|
||||
defer registriesMutex.Unlock()
|
||||
|
||||
}
|
||||
|
||||
// AddRegistry adds a registry to the global list of registries
|
||||
|
||||
Loading…
Reference in New Issue
Block a user