0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

Remove forking logger (#825)

- no longer needed, the race conditions were fixed

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
LaurentiuNiculae 2022-09-29 23:28:39 +03:00 committed by GitHub
parent e0d808b196
commit 885f139e0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 10 deletions

View file

@ -26,10 +26,8 @@ func EnableMetricsExtension(config *config.Config, log log.Logger, rootDir strin
} }
func SetupMetricsRoutes(config *config.Config, router *mux.Router, storeController storage.StoreController, func SetupMetricsRoutes(config *config.Config, router *mux.Router, storeController storage.StoreController,
l log.Logger, log log.Logger,
) { ) {
// fork a new zerolog child to avoid data race
log := log.Logger{Logger: l.With().Caller().Timestamp().Logger()}
log.Info().Msg("setting up metrics routes") log.Info().Msg("setting up metrics routes")
if config.Extensions.Metrics != nil && *config.Extensions.Metrics.Enable { if config.Extensions.Metrics != nil && *config.Extensions.Metrics.Enable {

View file

@ -62,10 +62,8 @@ func downloadTrivyDB(log log.Logger, updateInterval time.Duration) error {
} }
func SetupSearchRoutes(config *config.Config, router *mux.Router, storeController storage.StoreController, func SetupSearchRoutes(config *config.Config, router *mux.Router, storeController storage.StoreController,
l log.Logger, log log.Logger,
) { ) {
// fork a new zerolog child to avoid data race
log := log.Logger{Logger: l.With().Caller().Timestamp().Logger()}
log.Info().Msg("setting up search routes") log.Info().Msg("setting up search routes")
if config.Extensions.Search != nil && *config.Extensions.Search.Enable { if config.Extensions.Search != nil && *config.Extensions.Search.Enable {

View file

@ -614,9 +614,6 @@ func Run(ctx context.Context, cfg Config,
ticker := time.NewTicker(regCfg.PollInterval) ticker := time.NewTicker(regCfg.PollInterval)
// fork a new zerolog child to avoid data race
tlogger := log.Logger{Logger: logger.Logger}
retryOptions := &retry.RetryOptions{} retryOptions := &retry.RetryOptions{}
if regCfg.MaxRetries != nil { if regCfg.MaxRetries != nil {
@ -658,7 +655,7 @@ func Run(ctx context.Context, cfg Config,
continue continue
} }
} }
}(ctx, regCfg, tlogger) }(ctx, regCfg, logger)
} }
logger.Info().Msg("finished setting up sync") logger.Info().Msg("finished setting up sync")