MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / CheckNotificationLimit

Function CheckNotificationLimit

service/notify-limit.go:49–54  ·  view source on GitHub ↗

CheckNotificationLimit checks if the user has exceeded their notification limit Returns true if the user can send notification, false if limit exceeded

(userId int, notifyType string)

Source from the content-addressed store, hash-verified

47// CheckNotificationLimit checks if the user has exceeded their notification limit
48// Returns true if the user can send notification, false if limit exceeded
49func CheckNotificationLimit(userId int, notifyType string) (bool, error) {
50 if common.RedisEnabled {
51 return checkRedisLimit(userId, notifyType)
52 }
53 return checkMemoryLimit(userId, notifyType)
54}
55
56func checkRedisLimit(userId int, notifyType string) (bool, error) {
57 key := fmt.Sprintf("notify_limit:%d:%s:%s", userId, notifyType, time.Now().Format("2006010215"))

Callers 1

NotifyUserFunction · 0.85

Calls 2

checkRedisLimitFunction · 0.85
checkMemoryLimitFunction · 0.85

Tested by

no test coverage detected