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

Function startCleanupTask

service/notify-limit.go:30–45  ·  view source on GitHub ↗

startCleanupTask starts a background task to clean up expired entries

()

Source from the content-addressed store, hash-verified

28
29// startCleanupTask starts a background task to clean up expired entries
30func startCleanupTask() {
31 gopool.Go(func() {
32 for {
33 time.Sleep(time.Hour)
34 now := time.Now()
35 notifyLimitStore.Range(func(key, value interface{}) bool {
36 if limit, ok := value.(limitCount); ok {
37 if now.Sub(limit.Timestamp) >= getDuration() {
38 notifyLimitStore.Delete(key)
39 }
40 }
41 return true
42 })
43 }
44 })
45}
46
47// CheckNotificationLimit checks if the user has exceeded their notification limit
48// Returns true if the user can send notification, false if limit exceeded

Callers

nothing calls this directly

Calls 2

getDurationFunction · 0.85
DeleteMethod · 0.45

Tested by

no test coverage detected