sync: support reloading sync config when the config file changes

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
Petu Eusebiu
2022-02-10 16:17:49 +02:00
committed by Ramkumar Chinchani
parent 7e8cc3c71c
commit 6d04ab3cdc
11 changed files with 728 additions and 99 deletions
+4 -3
View File
@@ -4,6 +4,7 @@
package extensions
import (
"context"
goSync "sync"
"time"
@@ -69,14 +70,14 @@ func EnableExtensions(config *config.Config, log log.Logger, rootDir string) {
}
// EnableSyncExtension enables sync extension.
func EnableSyncExtension(config *config.Config, wg *goSync.WaitGroup,
func EnableSyncExtension(ctx context.Context, config *config.Config, wg *goSync.WaitGroup,
storeController storage.StoreController, log log.Logger) {
if config.Extensions.Sync != nil && *config.Extensions.Sync.Enable {
if err := sync.Run(*config.Extensions.Sync, storeController, wg, log); err != nil {
if err := sync.Run(ctx, *config.Extensions.Sync, storeController, wg, log); err != nil {
log.Error().Err(err).Msg("Error encountered while setting up syncing")
}
} else {
log.Info().Msg("Sync registries config not provided, skipping sync")
log.Info().Msg("Sync registries config not provided or disabled, skipping sync")
}
}