Reintregrate notifications with scanner

This commit is contained in:
viktorstrate
2020-06-23 15:13:07 +02:00
parent cc1eadaef4
commit 11c3a92373
7 changed files with 138 additions and 57 deletions

View File

@@ -15,6 +15,9 @@ func NewThrottle(interval time.Duration) Throttle {
}
func (t *Throttle) Trigger(action func()) {
if action == nil {
return
}
if time.Now().After(t.lastAction.Add(t.interval)) {
t.lastAction = time.Now()
action()