Skip to content

Commit 37986ed

Browse files
committed
derive new context outside anonymous function
Signed-off-by: Etai Lev Ran <[email protected]>
1 parent ebc8357 commit 37986ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/epp/datalayer/collector.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ func NewCollector() *Collector {
7777

7878
// Start initiates data source collection for the endpoint.
7979
func (c *Collector) Start(ctx context.Context, tick Ticker, ep Endpoint, registry *DataSourceRegistry) {
80+
epCtx, cancel := context.WithCancel(ctx)
81+
8082
c.startOnce.Do(func() {
81-
c.ctx, c.cancel = context.WithCancel(ctx)
83+
c.ctx = epCtx
84+
c.cancel = cancel
8285
c.done = make(chan struct{})
8386
c.ticker = tick
8487
// c.wg.Add(1)

0 commit comments

Comments
 (0)