-
Notifications
You must be signed in to change notification settings - Fork 592
backend: k8scache: add stopwatcher to remove the context from watch r… #4523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
e8cf48e
09dade5
4cab202
31e10c4
7fce783
6a551d8
439f32d
b992c9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,17 @@ func CheckForChanges( | |
| go runWatcher(ctx, k8scache, contextKey, kContext) | ||
| } | ||
|
|
||
| // StopWatcher stops and cleans up the watcher for a given contextKey. | ||
| func StopWatcher(contextKey string) { | ||
| logger.Log(logger.LevelInfo, nil, nil, "stopping watcher for context: "+contextKey) | ||
|
|
||
| if cancelAny, ok := contextCancel.Load(contextKey); ok { | ||
| cancelAny.(context.CancelFunc)() | ||
| contextCancel.Delete(contextKey) | ||
| watcherRegistry.Delete(contextKey) | ||
| } | ||
| } | ||
|
Comment on lines
164
to
173
|
||
|
|
||
| // runWatcher is a long-lived goroutine that sets up and runs Kubernetes informers. | ||
| // It watches for resource changes and invalidates corresponding cache entries. | ||
| // This function will only exit when its context is cancelled. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.