fix(auth): replace MarkResult with hook OnResult for result handling
This commit is contained in:
@@ -169,12 +169,12 @@ func NewManager(store Store, selector Selector, hook Hook) *Manager {
|
|||||||
hook = NoopHook{}
|
hook = NoopHook{}
|
||||||
}
|
}
|
||||||
manager := &Manager{
|
manager := &Manager{
|
||||||
store: store,
|
store: store,
|
||||||
executors: make(map[string]ProviderExecutor),
|
executors: make(map[string]ProviderExecutor),
|
||||||
selector: selector,
|
selector: selector,
|
||||||
hook: hook,
|
hook: hook,
|
||||||
auths: make(map[string]*Auth),
|
auths: make(map[string]*Auth),
|
||||||
providerOffsets: make(map[string]int),
|
providerOffsets: make(map[string]int),
|
||||||
refreshSemaphore: make(chan struct{}, refreshMaxConcurrency),
|
refreshSemaphore: make(chan struct{}, refreshMaxConcurrency),
|
||||||
}
|
}
|
||||||
// atomic.Value requires non-nil initial value.
|
// atomic.Value requires non-nil initial value.
|
||||||
@@ -691,14 +691,14 @@ func (m *Manager) executeCountMixedOnce(ctx context.Context, providers []string,
|
|||||||
if ra := retryAfterFromError(errExec); ra != nil {
|
if ra := retryAfterFromError(errExec); ra != nil {
|
||||||
result.RetryAfter = ra
|
result.RetryAfter = ra
|
||||||
}
|
}
|
||||||
m.MarkResult(execCtx, result)
|
m.hook.OnResult(execCtx, result)
|
||||||
if isRequestInvalidError(errExec) {
|
if isRequestInvalidError(errExec) {
|
||||||
return cliproxyexecutor.Response{}, errExec
|
return cliproxyexecutor.Response{}, errExec
|
||||||
}
|
}
|
||||||
lastErr = errExec
|
lastErr = errExec
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.MarkResult(execCtx, result)
|
m.hook.OnResult(execCtx, result)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user