MCPcopy
hub / github.com/safing/portmaster / isOverThreshold

Function isOverThreshold

service/compat/notify.go:253–270  ·  view source on GitHub ↗
(id string)

Source from the content-addressed store, hash-verified

251}
252
253func isOverThreshold(id string) bool {
254 notifyThresholdsLock.Lock()
255 defer notifyThresholdsLock.Unlock()
256
257 // Get notify threshold and check if we reach the minimum incidents.
258 nt, ok := notifyThresholds[id]
259 if ok && !nt.expired() {
260 nt.Incidents++
261 return nt.Incidents >= notifyThresholdMinIncidents
262 }
263
264 // Add new entry.
265 notifyThresholds[id] = &notifyThreshold{
266 FirstSeen: time.Now(),
267 Incidents: 1,
268 }
269 return false
270}
271
272func cleanNotifyThreshold(ctx *mgr.WorkerCtx) error {
273 notifyThresholdsLock.Lock()

Callers 1

notifyMethod · 0.85

Calls 3

expiredMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected