feat: Implement notification rate limiting mechanism
- Add in-memory and Redis-based notification rate limiting - Create configurable hourly notification limits - Implement notification limit checking for user notifications - Add environment variables for customizing notification limits
This commit is contained in:
@@ -356,6 +356,13 @@ func CompletionRatio2JSONString() string {
|
||||
return string(jsonBytes)
|
||||
}
|
||||
|
||||
func UpdateCompletionRatioByJSONString(jsonStr string) error {
|
||||
CompletionRatioMutex.Lock()
|
||||
defer CompletionRatioMutex.Unlock()
|
||||
CompletionRatio = make(map[string]float64)
|
||||
return json.Unmarshal([]byte(jsonStr), &CompletionRatio)
|
||||
}
|
||||
|
||||
func GetCompletionRatio(name string) float64 {
|
||||
GetCompletionRatioMap()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user