提交 e58b8568 编写于 作者: B Benjamin Pasero

prevent too much work in whenDeleted()

上级 dd1c9908
......@@ -194,13 +194,19 @@ export function whenDeleted(path: string): TPromise<void> {
// Complete when wait marker file is deleted
return new TPromise<void>(c => {
let running = false;
const interval = setInterval(() => {
fs.exists(path, exists => {
if (!exists) {
clearInterval(interval);
c(null);
}
});
if (!running) {
running = true;
fs.exists(path, exists => {
running = false;
if (!exists) {
clearInterval(interval);
c(null);
}
});
}
}, 1000);
});
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册