Don't sleep on first scan to ease testing

This commit is contained in:
2023-04-05 17:11:06 -06:00
parent 20c664f0ed
commit a8e9a68f0e
+9 -2
View File
@@ -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 {