Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debt: avoid promise.cancel in zip.ts #56656

Merged
merged 2 commits into from Aug 22, 2018
Merged

Debt: avoid promise.cancel in zip.ts #56656

merged 2 commits into from Aug 22, 2018

Conversation

bpasero
Copy link
Member

@bpasero bpasero commented Aug 17, 2018

For #56137

@sandy081 adding you because this area is sensitive for extracting extensions. I converted the code to use CancellationToken and avoid TPromise.cancel().

/cc @jrieken

@bpasero bpasero added this to the August 2018 milestone Aug 17, 2018
@bpasero bpasero self-assigned this Aug 17, 2018
@bpasero bpasero requested a review from sandy081 August 17, 2018 08:55
const throttler = new SimpleThrottler();
return createCancelablePromise(token => {

once(token.onCancellationRequested)(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No once not needed as the event will only ever fire once

}

if (!options.sourcePathRegex.test(entry.fileName)) {
readNextEntry();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not passing the real token instead of none token?

}

if (!options.sourcePathRegex.test(entry.fileName)) {
readNextEntry(CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not passing the real token instead of none token?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I guess I added this first and only later added the token.

@bpasero
Copy link
Member Author

bpasero commented Aug 20, 2018

@sandy081 can you check again, I also removed isCanceled with token.isCancelationRequested

@sandy081
Copy link
Member

LGTM

@bpasero bpasero merged commit a493688 into master Aug 22, 2018
@bpasero bpasero deleted the ben-56137 branch August 22, 2018 05:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants