diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-09-12 23:08:37 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-09-12 23:08:37 +0200 |
commit | abe7117874e6215cde2e63b97971ac629769190a (patch) | |
tree | 8e83a97bf5b9c04477501e2ef47c02d64884f981 | |
parent | 2a1b5dcffa49ec9edcc55a27ec301ed6f188ac31 (diff) | |
download | mailremind-abe7117874e6215cde2e63b97971ac629769190a.tar.gz mailremind-abe7117874e6215cde2e63b97971ac629769190a.tar.bz2 mailremind-abe7117874e6215cde2e63b97971ac629769190a.zip |
Jobs will nmow be checked directly after starting.
-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 { |