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

Revert "debt - dispose one CancellationTokenSource"

This reverts commit 94aaf389.
上级 27c68d92
......@@ -278,14 +278,14 @@ export class FileService implements IFileService {
value: void 0
};
const contentResolverTokenSource = new CancellationTokenSource();
const contentResolverToken = new CancellationTokenSource();
const onStatError = (error: Error) => {
// error: stop reading the file the stat and content resolve call
// usually race, mostly likely the stat call will win and cancel
// the content call
contentResolverTokenSource.cancel();
contentResolverToken.cancel();
// forward error
return TPromise.wrapError(error);
......@@ -353,21 +353,17 @@ export class FileService implements IFileService {
// etag from the stat before we actually read the file again.
if (options && options.etag) {
completePromise = statsPromise.then(() => {
return this.fillInContents(result, resource, options, contentResolverTokenSource.token); // Waterfall -> only now resolve the contents
return this.fillInContents(result, resource, options, contentResolverToken.token); // Waterfall -> only now resolve the contents
});
}
// a fresh load without a previous etag which means we can resolve the file stat
// and the content at the same time, avoiding the waterfall.
else {
completePromise = Promise.all([statsPromise, this.fillInContents(result, resource, options, contentResolverTokenSource.token)]);
completePromise = Promise.all([statsPromise, this.fillInContents(result, resource, options, contentResolverToken.token)]);
}
return TPromise.wrap(completePromise).then(() => {
contentResolverTokenSource.dispose();
return result;
});
return TPromise.wrap(completePromise).then(() => result);
}
private fillInContents(content: IStreamContent, resource: uri, options: IResolveContentOptions, token: CancellationToken): Thenable<any> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册