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
+7
View File
@@ -27,9 +27,16 @@ type tag struct {
} }
func pollJob(pipeline database.Pipeline, pipelineConf config.PipelineConf, db database.Database) { func pollJob(pipeline database.Pipeline, pipelineConf config.PipelineConf, db database.Database) {
firstScan := true
for { for {
// 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) time.Sleep(time.Duration(pipeline.PollInterval) * time.Second)
log.Infof("Polling repo %v", pipeline.Name) log.Infof("Polling repo %v", pipeline.Name)
} else {
firstScan = false
}
prevRefs, err := db.GetPipelineRefs(pipeline.Id) prevRefs, err := db.GetPipelineRefs(pipeline.Id)
if err != nil { if err != nil {