diff options
| author | Bartosz Sławianowski <eplightning@outlook.com> | 2021-03-29 15:04:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-29 15:04:06 +0200 |
| commit | 5da428becd76dcdd97a70dfcf1f8e5a120f841e5 (patch) | |
| tree | fa467cf4c26eb5dd3755675546b5834ac375b8c9 /cmd | |
| parent | b879041c2dc28dd723d1f20991b190de83020d74 (diff) | |
fix: Prevent concurrent updates to git repositories (#177)
* Add method docs and RequiresLocking method
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/main.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/main.go b/cmd/main.go index 9d5e62f..f604ef8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -118,6 +118,8 @@ func runImageUpdater(cfg *ImageUpdaterConfig, warmUp bool) (argocd.ImageUpdaterR log.Infof("Starting image update cycle, considering %d annotated application(s) for update", len(appList)) } + syncState := argocd.NewSyncIterationState() + // Allow a maximum of MaxConcurrency number of goroutines to exist at the // same time. If in warm-up mode, set to 1 explicitly. var concurrency int = cfg.MaxConcurrency @@ -155,7 +157,7 @@ func runImageUpdater(cfg *ImageUpdaterConfig, warmUp bool) (argocd.ImageUpdaterR GitCommitEmail: cfg.GitCommitMail, DisableKubeEvents: cfg.DisableKubeEvents, } - res := argocd.UpdateApplication(upconf) + res := argocd.UpdateApplication(upconf, syncState) result.NumApplicationsProcessed += 1 result.NumErrors += res.NumErrors result.NumImagesConsidered += res.NumImagesConsidered |
