Instantiate new client for each spawned worker

This commit is contained in:
Nikolay Edigaryev 2026-02-06 17:25:44 +01:00
parent bdc2af3d58
commit 5211eca66b
1 changed files with 5 additions and 5 deletions

View File

@ -165,11 +165,6 @@ func runWorker(cmd *cobra.Command, args []string) (err error) {
"in the bootstrap token", ErrRunFailed)
}
controllerClient, err := client.New(clientOpts...)
if err != nil {
return err
}
// Initialize the logger
logger, err := createLogger()
if err != nil {
@ -226,6 +221,11 @@ func runWorker(cmd *cobra.Command, args []string) (err error) {
workerOptsLocal = append(workerOptsLocal, worker.WithNameSuffix(fmt.Sprintf("-%d", i+1)))
}
controllerClient, err := client.New(clientOpts...)
if err != nil {
return err
}
workerInstance, err := worker.New(controllerClient, workerOptsLocal...)
if err != nil {
return err