Skip to content

Commit 65c4fa0

Browse files
committed
fix: handle onError in non-restart path for noWatch sync
Address review feedback: when RestartOnError is false (noWatch), add an else block to listen for onError and onDone channels. Previously, these channels went unlistened when noWatch was true, which could cause goroutine leaks. Signed-off-by: rvasikarla <rvasikarla@splunk.com>
1 parent cc6d51c commit 65c4fa0

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

pkg/devspace/services/sync/controller.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,23 @@ func (c *controller) startWithWait(ctx devspacecontext.Context, options *Options
226226
}
227227
return nil
228228
})
229+
} else {
230+
parent.Go(func() error {
231+
select {
232+
case <-ctx.Context().Done():
233+
syncStop(ctx, client, options, parent)
234+
case err := <-onError:
235+
hook.LogExecuteHooks(ctx.WithLogger(options.SyncLog), map[string]interface{}{
236+
"sync_config": options.SyncConfig,
237+
"ERROR": err,
238+
}, hook.EventsForSingle("error:sync", options.Name).With("sync.error")...)
239+
ctx.Log().Errorf("Sync error: %v", err)
240+
syncStop(ctx, client, options, parent)
241+
case <-onDone:
242+
syncDone(ctx, options, parent)
243+
}
244+
return nil
245+
})
229246
}
230247

231248
return nil

0 commit comments

Comments
 (0)