From fde291c1ff11d747721967dfd008b3ea8c5fd728 Mon Sep 17 00:00:00 2001 From: ppom <> Date: Sat, 9 Sep 2023 19:46:04 +0200 Subject: [PATCH] remove code by using more adapted stdlib function --- app/daemon.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/daemon.go b/app/daemon.go index 618ab24..92beeee 100644 --- a/app/daemon.go +++ b/app/daemon.go @@ -73,16 +73,6 @@ func (f *Filter) execActions(match string, advance time.Duration) { } } -func sleep(d time.Duration) chan bool { - c := make(chan bool) - go func() { - time.Sleep(d) - c <- true - close(c) - }() - return c -} - func (a *Action) exec(match string, advance time.Duration) { defer wgActions.Done() @@ -90,7 +80,7 @@ func (a *Action) exec(match string, advance time.Duration) { if a.afterDuration != 0 && a.afterDuration > advance { stopAction := actionStore.Register(a, match) select { - case <-sleep(a.afterDuration - advance): + case <-time.After(a.afterDuration - advance): // Let's not wait for the lock go actionStore.Unregister(a, match, stopAction) case doExec := <-stopAction: