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