diff --git a/go.mod b/go.mod index d91f96c1d..dbe135012 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/drone/drone-go v1.0.6 github.com/drone/drone-runtime v1.1.0 github.com/drone/drone-ui v0.0.0-20191004020100-87de5a7c28a9 - github.com/drone/drone-yaml v1.2.3-0.20191031071139-9036725284d3 + github.com/drone/drone-yaml v1.2.3 github.com/drone/envsubst v1.0.1 github.com/drone/go-license v1.0.2 github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2 diff --git a/go.sum b/go.sum index 351aecca8..91538b1d1 100644 --- a/go.sum +++ b/go.sum @@ -132,6 +132,8 @@ github.com/drone/drone-yaml v1.2.3-0.20190924213155-be6b37e0b4cd h1:xbC7iwsybaLu github.com/drone/drone-yaml v1.2.3-0.20190924213155-be6b37e0b4cd/go.mod h1:QsqliFK8nG04AHFN9tTn9XJomRBQHD4wcejWW1uz/10= github.com/drone/drone-yaml v1.2.3-0.20191031071139-9036725284d3 h1:tUvugKpWy7VSClNaRbt14XxebGWDmkethAgJPrfu+1M= github.com/drone/drone-yaml v1.2.3-0.20191031071139-9036725284d3/go.mod h1:QsqliFK8nG04AHFN9tTn9XJomRBQHD4wcejWW1uz/10= +github.com/drone/drone-yaml v1.2.3 h1:SWzLmzr8ARhbtw1WsVDENa8WFY2Pi9l0FVMfafVUWz8= +github.com/drone/drone-yaml v1.2.3/go.mod h1:QsqliFK8nG04AHFN9tTn9XJomRBQHD4wcejWW1uz/10= github.com/drone/envsubst v1.0.1 h1:NOOStingM2sbBwsIUeQkKUz8ShwCUzmqMxWrpXItfPE= github.com/drone/envsubst v1.0.1/go.mod h1:bkZbnc/2vh1M12Ecn7EYScpI4YGYU0etwLJICOWi8Z0= github.com/drone/go-license v1.0.2 h1:7OwndfYk+Lp/cGHkxe4HUn/Ysrrw3WYH2pnd99yrkok= diff --git a/trigger/cron/cron.go b/trigger/cron/cron.go index 500986223..cc93837da 100644 --- a/trigger/cron/cron.go +++ b/trigger/cron/cron.go @@ -46,11 +46,14 @@ type Scheduler struct { // Start starts the cron scheduler. func (s *Scheduler) Start(ctx context.Context, dur time.Duration) error { + ticker := time.NewTicker(dur) + defer ticker.Stop() + for { select { case <-ctx.Done(): return ctx.Err() - case <-time.After(dur): + case <-ticker.C: s.run(ctx) } }