Ver código fonte

Fixes #1432: Stops throwing for cancelled promise

main
Eric Amodio 3 anos atrás
pai
commit
afa3252440
4 arquivos alterados com 5 adições e 23 exclusões
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      src/hovers/hovers.ts
  3. +2
    -21
      src/system/decorators/timeout.ts
  4. +1
    -1
      src/views/nodes/contributorsNode.ts

+ 1
- 0
CHANGELOG.md Ver arquivo

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#1432](https://github.com/eamodio/vscode-gitlens/issues/1432) - Unhandled Timeout Promise
- Fixes [#1562](https://github.com/eamodio/vscode-gitlens/issues/1562) - Yarn audit fails with 2 high sev vulnerabilities (dev dependencies only) — thanks to [PR #1563](https://github.com/eamodio/vscode-gitlens/pull/1563) by Ivan Volzhev ([@ivolzhevbt](https://github.com/ivolzhevbt))
- Fixes [#1566](https://github.com/eamodio/vscode-gitlens/issues/1566) - Bug: unable to open 'pr.url' when clicking PR link
- Fixes [#1545](https://github.com/eamodio/vscode-gitlens/issues/1545) - Missing branch comparison controls in versions 11.5.0 and 11.5.1

+ 1
- 1
src/hovers/hovers.ts Ver arquivo

@ -193,7 +193,7 @@ export namespace Hovers {
commit.isUncommitted ? commit.getPreviousLineDiffUris(uri, editorLine, uri.sha) : undefined,
getAutoLinkedIssuesOrPullRequests(commit.message, remotes),
getPullRequestForCommit(commit.ref, remotes),
Container.vsls.maybeGetPresence(commit.email).catch(() => undefined),
Container.vsls.maybeGetPresence(commit.email),
]);
const details = await CommitFormatter.fromTemplateAsync(Container.config.hovers.detailsMarkdownFormat, commit, {

+ 2
- 21
src/system/decorators/timeout.ts Ver arquivo

@ -1,5 +1,5 @@
'use strict';
import { CancellationError, is as isPromise } from '../promise';
import { cancellable, is as isPromise } from '../promise';
export function timeout(timeout: number): any;
export function timeout(timeoutFromLastArg: true, defaultTimeout?: number): any;
@ -32,26 +32,7 @@ export function timeout(timeoutOrTimeoutFromLastArg: number | boolean, defaultTi
const result = fn?.apply(this, args);
if (timeout == null || timeout < 1 || !isPromise(result)) return result;
// const cc = Logger.getCorrelationContext();
// const start = process.hrtime();
return Promise.race([
result,
// result.then(r => {
// Logger.debug(
// cc,
// `${GlyphChars.Dash} timed out, but completed after ${Strings.getDurationMilliseconds(start)} ms`
// );
// return r;
// }),
new Promise((_, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject(new CancellationError(result, `Timed out after ${timeout} ms`));
}, timeout);
}),
]);
return cancellable(result, timeout, { onDidCancel: resolve => resolve(undefined) });
};
};
}

+ 1
- 1
src/views/nodes/contributorsNode.ts Ver arquivo

@ -55,7 +55,7 @@ export class ContributorsNode extends ViewNode
if (contributors.length === 0) return [new MessageNode(this.view, this, 'No contributors could be found.')];
GitContributor.sort(contributors);
const presenceMap = await this.maybeGetPresenceMap(contributors).catch(() => undefined);
const presenceMap = await this.maybeGetPresenceMap(contributors);
this._children = contributors.map(
c => new ContributorNode(this.uri, this.view, this, c, { all: all, ref: ref, presence: presenceMap }),

Carregando…
Cancelar
Salvar