diff options
Diffstat (limited to 'checkmails.go')
-rw-r--r-- | checkmails.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/checkmails.go b/checkmails.go index 926f057..576c2c2 100644 --- a/checkmails.go +++ b/checkmails.go @@ -18,11 +18,17 @@ func initCheckmails() { } func checkmails() { - ticker := time.NewTicker(time.Duration(checkInterval) * time.Second) + timech := make(chan time.Time) + go func(ch chan time.Time) { + ticker := time.NewTicker(time.Duration(checkInterval) * time.Second) - for { - t := <-ticker.C + ch <- time.Now() + for t := range ticker.C { + ch <- t + } + }(timech) + for t := range timech { jobs := dbcon.JobsBefore(t) for _, job := range jobs { |