Fix WidgetPool goroutine and ticker leak
- Add context cancellation to WidgetPool cleanup goroutine - Properly stop ticker when context is canceled - Add BackgroundContext() getter method to App for context access - Pass application context to NewWidgetPool for lifecycle management This fixes a resource leak where the cleanup goroutine would run indefinitely without any way to stop it, preventing proper cleanup on application shutdown.
This commit is contained in:
@@ -504,6 +504,12 @@ func (a *App) DeleteServerCacheDir(serverID uuid.UUID) error {
|
||||
return os.RemoveAll(path)
|
||||
}
|
||||
|
||||
// BackgroundContext returns the application's background context
|
||||
// which is canceled when the application shuts down.
|
||||
func (a *App) BackgroundContext() context.Context {
|
||||
return a.bgrndCtx
|
||||
}
|
||||
|
||||
func (a *App) Shutdown() {
|
||||
if a.logFile != nil {
|
||||
a.logFile.Close()
|
||||
|
||||
Reference in New Issue
Block a user