History

fix(registry): Reset client status on model re-registration

When a client re-registers with the model registry, its previous status for a given model (e.g., quota exceeded or suspended) was not being cleared. This could lead to a situation where a client is permanently unable to use a model even after re-registering. This change ensures that when a client re-registers an existing model, its ID is removed from the model's `QuotaExceededClients` and `SuspendedClients` lists. This effectively resets the client's status for that model, allowing for a fresh start upon reconnection.

hkfires committed 1 year ago

Commit e1de0421 parent a887a331 file · +6 −0Browse files

Unified · Split

internal/registry/model_registry.go+6−0
@@ -237,6 +237,12 @@ func (r *ModelRegistry) RegisterClient(clientID, clientProvider string, models [ · 236 unmodified lines
237237 if reg, ok := r.models[id]; ok {
238238 reg.Info = cloneModelInfo(model)
239239 reg.LastUpdated = now
240+ if reg.QuotaExceededClients != nil {
241+ delete(reg.QuotaExceededClients, clientID)
242+ }
243+ if reg.SuspendedClients != nil {
244+ delete(reg.SuspendedClients, clientID)
245+ }
240246 if providerChanged && provider != "" {
241247 if _, newlyAdded := addedSet[id]; newlyAdded {
242248 continue

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t