From a8e9a68f0e159348def8599f3003a9c61200924f Mon Sep 17 00:00:00 2001 From: restitux Date: Wed, 5 Apr 2023 17:11:06 -0600 Subject: [PATCH] Don't sleep on first scan to ease testing --- poll/poll.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/poll/poll.go b/poll/poll.go index a13dae0..27170f7 100644 --- a/poll/poll.go +++ b/poll/poll.go @@ -27,9 +27,16 @@ type tag struct { } func pollJob(pipeline database.Pipeline, pipelineConf config.PipelineConf, db database.Database) { + firstScan := true for { - time.Sleep(time.Duration(pipeline.PollInterval) * time.Second) - log.Infof("Polling repo %v", pipeline.Name) + // Don't sleep on first scan to ease testing + // TODO: this should be replaced with a script that mocks a webhook + if !firstScan { + time.Sleep(time.Duration(pipeline.PollInterval) * time.Second) + log.Infof("Polling repo %v", pipeline.Name) + } else { + firstScan = false + } prevRefs, err := db.GetPipelineRefs(pipeline.Id) if err != nil {