watcher - 💄

上级 24b3b589
...@@ -356,7 +356,7 @@ export class NsfwWatcherService extends Disposable implements IWatcherService { ...@@ -356,7 +356,7 @@ export class NsfwWatcherService extends Disposable implements IWatcherService {
} }
// Watcher path came back! Restart watching... // Watcher path came back! Restart watching...
if (path === watcher.request.path && type === 'added' || type === 'changed') { if (path === watcher.request.path && (type === 'added' || type === 'changed')) {
// Stop watching that parent folder // Stop watching that parent folder
disposable.dispose(); disposable.dispose();
...@@ -366,6 +366,10 @@ export class NsfwWatcherService extends Disposable implements IWatcherService { ...@@ -366,6 +366,10 @@ export class NsfwWatcherService extends Disposable implements IWatcherService {
// Restart the file watching delayed // Restart the file watching delayed
const scheduler = new RunOnceScheduler(() => { const scheduler = new RunOnceScheduler(() => {
if (watcher.token.isCancellationRequested) {
return; // return early when disposed
}
this.warn('Watcher service restarts for watched path got created again', watcher); this.warn('Watcher service restarts for watched path got created again', watcher);
this.restartWatching(watcher); this.restartWatching(watcher);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册