mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Add nil-check for GetRequestMutex across handlers to prevent potential panics
- Updated all handlers to safely unlock the request mutex only if it's non-nil. - Enhanced mutex locking and unlocking logic to avoid runtime errors. - Improved robustness of resource cleanup across clients. Add `GetRequestMutex` method for synchronization across clients - Introduced a new `GetRequestMutex` method in OpenAICompatibilityClient, CodexClient, GeminiCLIClient, GeminiClient, and QwenClient for request synchronization. - Ensures only one request is processed at a time to manage quotas effectively.
This commit is contained in:
@@ -557,3 +557,12 @@ func (c *ClaudeClient) IsModelQuotaExceeded(model string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetRequestMutex returns the mutex used to synchronize requests for this client.
|
||||
// This ensures that only one request is processed at a time for quota management.
|
||||
//
|
||||
// Returns:
|
||||
// - *sync.Mutex: The mutex used for request synchronization
|
||||
func (c *ClaudeClient) GetRequestMutex() *sync.Mutex {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user