Skip to content

Commit 7ffed83

Browse files
pulak-optiSucco
andauthored
[FSSDK-9155] fix(ticker): stop all tickers to prevent goroutine leak (#375)
* fix(ticker): stop all tickers to prevent goroutine leak * chore: update years in all affected files * fix header indentation --------- Co-authored-by: Succo <[email protected]>
1 parent e74765c commit 7ffed83

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

pkg/config/polling_manager.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019-2020,2022 Optimizely, Inc. and contributors *
2+
* Copyright 2019-2020,2022-2023 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -191,6 +191,7 @@ func (cm *PollingProjectConfigManager) Start(ctx context.Context) {
191191
case <-t.C:
192192
cm.SyncConfig()
193193
case <-ctx.Done():
194+
t.Stop()
194195
cm.logger.Debug("Polling Config Manager Stopped")
195196
return
196197
}

pkg/event/processor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019-2020, Optimizely, Inc. and contributors *
2+
* Copyright 2019-2020,2023 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -246,6 +246,7 @@ func (p *BatchEventProcessor) startTicker(ctx context.Context) {
246246
if ok {
247247
d.flushEvents()
248248
}
249+
p.Ticker.Stop()
249250
return
250251
}
251252
}

pkg/odp/event/event_manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ func (bm *BatchEventManager) startTicker(ctx context.Context, odpConfig config.C
237237
case <-ctx.Done():
238238
bm.logger.Debug("BatchEventManager stopped, flushing events.")
239239
bm.FlushEvents(odpConfig.GetAPIKey(), odpConfig.GetAPIHost())
240+
bm.flushLock.Lock()
241+
bm.ticker.Stop()
242+
bm.flushLock.Unlock()
240243
return
241244
}
242245
}

0 commit comments

Comments
 (0)