Skip to content

Commit

Permalink
fix: configure context timeout for sync resources (#1974)
Browse files Browse the repository at this point in the history
* fix: configure context timeout for sync resources

Signed-off-by: chenk <hen.keinan@gmail.com>

* fix: configure context timeout for sync resources

Signed-off-by: chenk <hen.keinan@gmail.com>

---------

Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed Apr 3, 2024
1 parent b798f2c commit 8ca4b5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ func Start(ctx context.Context, buildInfo trivyoperator.BuildInfo, operatorConfi
}
}

ctxWithTimeout, cancel := context.WithTimeout(ctx, *operatorConfig.ControllerCacheSyncTimeout)
defer cancel()
setupLog.Info("Starting controllers manager")
if err := mgr.Start(ctx); err != nil {
if err := mgr.Start(ctxWithTimeout); err != nil {
return fmt.Errorf("starting controllers manager: %w", err)
}

Expand Down

0 comments on commit 8ca4b5f

Please sign in to comment.