Initialize base context when creating New worker and not at start (#3294)
This commit is contained in:
1 file changed
+3
-3
@@ -188,7 +188,10 @@ func New(ctx context.Context, conf *Config) (*Worker, error) {
|
||||
metric.InitializeClusterClientCollectors(conf.PrometheusRegisterer)
|
||||
initializeReverseGrpcClientCollectors(conf.PrometheusRegisterer)
|
||||
|
||||
baseContext, baseCancel := context.WithCancel(context.Background())
|
||||
w := &Worker{
|
||||
baseContext: baseContext,
|
||||
baseCancel: baseCancel,
|
||||
conf: conf,
|
||||
logger: conf.Logger.Named("worker"),
|
||||
started: ua.NewBool(false),
|
||||
@@ -358,9 +361,6 @@ func (w *Worker) Reload(ctx context.Context, newConf *config.Config) {
|
||||
|
||||
func (w *Worker) Start() error {
|
||||
const op = "worker.(Worker).Start"
|
||||
|
||||
w.baseContext, w.baseCancel = context.WithCancel(context.Background())
|
||||
|
||||
if w.started.Load() {
|
||||
event.WriteSysEvent(w.baseContext, op, "already started, skipping")
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user