feat(redis): implement Pub/Sub support for usage tracking
- Added Redis Pub/Sub capability to broadcast usage updates to subscribed clients. - Enhanced `redisqueue` with subscriber management and message broadcasting. - Updated tests to validate Pub/Sub message handling, subscription behavior, and fallback to the queue after unsubscribing. - Integrated `project_id` parsing into auth-files logic to include project identifiers in metadata. Closes: #3027
This commit is contained in:
@@ -190,6 +190,21 @@ func IsOAuthSessionPending(state, provider string) bool {
|
||||
return oauthSessions.IsPending(state, provider)
|
||||
}
|
||||
|
||||
func oauthSessionErrorWithCause(message string, cause error) string {
|
||||
message = strings.TrimSpace(message)
|
||||
if message == "" {
|
||||
message = "Authentication failed"
|
||||
}
|
||||
if cause == nil {
|
||||
return message
|
||||
}
|
||||
detail := strings.TrimSpace(cause.Error())
|
||||
if detail == "" {
|
||||
return message
|
||||
}
|
||||
return message + ": " + detail
|
||||
}
|
||||
|
||||
func ValidateOAuthState(state string) error {
|
||||
trimmed := strings.TrimSpace(state)
|
||||
if trimmed == "" {
|
||||
|
||||
Reference in New Issue
Block a user