feat(auth): Optimize retry logic and add circuit breaker for team processing
- Reduce authorization retry attempts from 3 to 2 and optimize retry delays from exponential (3s, 5s, 8s, 12s) to fixed 3s backoff - Implement team-level circuit breaker: skip member processing when 3+ consecutive 500 errors detected in same team - Add consecutive 500 error tracking with atomic counter and reset on successful authorization - Reduce ObtainAuthorizationCode timeout from 3 minutes to 90 seconds with updated error messages - Optimize Codex API workspace selection retry: reduce max attempts from 5 to 3 with shorter backoff (2s, 4s instead of 3s, 5s, 8s, 12s) - Reduce S2A OAuth submission retry delays from (4s, 6s) to (2s, 3s) for faster failure detection - Optimize member stagger timing: reduce from 3s + idx*2s to 1s + idx*1s with reduced jitter (0-1s instead of 0-2s) - Add early exit for exhausted retries in CompleteWithCodexAPI to prevent unnecessary outer retry attempts - These changes improve responsiveness and reduce cascading failures during bulk team processing
This commit is contained in:
@@ -133,7 +133,7 @@ func SubmitS2AOAuth(s2aAPIBase, s2aAdminKey, sessionID, code, name string, concu
|
||||
var lastErr error
|
||||
for attempt := 0; attempt < 3; attempt++ {
|
||||
if attempt > 0 {
|
||||
time.Sleep(time.Duration(2+attempt*2) * time.Second) // 4s, 6s
|
||||
time.Sleep(time.Duration(1+attempt) * time.Second) // 2s, 3s
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest("POST", apiURL, bytes.NewReader(body))
|
||||
|
||||
Reference in New Issue
Block a user