We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c1becd4 + f0a137d commit 339702aCopy full SHA for 339702a
cron.go
@@ -165,8 +165,9 @@ func (c *Cron) run() {
165
effective = c.entries[0].Next
166
}
167
168
+ timer := time.NewTimer(effective.Sub(now))
169
select {
- case now = <-time.After(effective.Sub(now)):
170
+ case now = <-timer.C:
171
// Run every entry whose next time was this effective time.
172
for _, e := range c.entries {
173
if e.Next != effective {
@@ -186,11 +187,13 @@ func (c *Cron) run() {
186
187
c.snapshot <- c.entrySnapshot()
188
189
case <-c.stop:
190
+ timer.Stop()
191
return
192
193
194
// 'now' should be updated after newEntry and snapshot cases.
195
now = time.Now().Local()
196
197
198
199
0 commit comments