1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: Dispose the kubeconfig watcher when application quits

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2023-04-05 12:08:41 +03:00
parent 673144ae8f
commit d0116b3b62
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A

View File

@ -98,11 +98,19 @@ export class KubeconfigSyncManager {
@action @action
protected stopOldSync(filePath: string): void { protected stopOldSync(filePath: string): void {
if (!this.sources.delete(filePath)) { const source = this.sources.get(filePath);
// already stopped // already stopped
if (!source) {
return this.dependencies.logger.debug(`no syncing file/folder to stop`, { filePath }); return this.dependencies.logger.debug(`no syncing file/folder to stop`, { filePath });
} }
const [, disposer] = source;
disposer();
this.sources.delete(filePath);
this.dependencies.logger.info(`stopping sync of file/folder`, { filePath }); this.dependencies.logger.info(`stopping sync of file/folder`, { filePath });
this.dependencies.logger.debug(`${this.sources.size} files/folders watched`, { files: Array.from(this.sources.keys()) }); this.dependencies.logger.debug(`${this.sources.size} files/folders watched`, { files: Array.from(this.sources.keys()) });
} }