mirror of
https://github.com/project-zot/zot.git
synced 2025-02-17 23:45:36 -05:00
Fix negative WaitGroup counter at runtime
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
fc4a34d43a
commit
5f04092e71
1 changed files with 3 additions and 3 deletions
|
@ -476,9 +476,6 @@ func Run(cfg Config, storeController storage.StoreController, wg *goSync.WaitGro
|
|||
continue
|
||||
}
|
||||
|
||||
// increment reference since will be busy, so shutdown has to wait
|
||||
wg.Add(1)
|
||||
|
||||
ticker := time.NewTicker(regCfg.PollInterval)
|
||||
|
||||
// fork a new zerolog child to avoid data race
|
||||
|
@ -490,6 +487,9 @@ func Run(cfg Config, storeController storage.StoreController, wg *goSync.WaitGro
|
|||
go func(regCfg RegistryConfig, l log.Logger) {
|
||||
// run on intervals
|
||||
for ; true; <-ticker.C {
|
||||
// increment reference since will be busy, so shutdown has to wait
|
||||
wg.Add(1)
|
||||
|
||||
if err := syncRegistry(regCfg, storeController, l, localCtx, policyCtx,
|
||||
credentialsFile[upstreamRegistry], uuid.String()); err != nil {
|
||||
l.Error().Err(err).Msg("sync exited with error, stopping it...")
|
||||
|
|
Loading…
Add table
Reference in a new issue