Browse Source

Switches to use Promise.allSettled

main
Eric Amodio 2 years ago
parent
commit
7f8a0af9a9
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/git/gitProviderService.ts

+ 5
- 2
src/git/gitProviderService.ts View File

@ -28,7 +28,7 @@ import { gate } from '../system/decorators/gate';
import { debug, getLogScope, log } from '../system/decorators/log';
import { count, filter, first, flatMap, map, some } from '../system/iterable';
import { getBestPath, getScheme, isAbsolute, maybeUri, normalizePath } from '../system/path';
import { cancellable, fastestSettled, isPromise, PromiseCancelledError } from '../system/promise';
import { cancellable, fastestSettled, getSettledValue, isPromise, PromiseCancelledError } from '../system/promise';
import { VisitedPathsTrie } from '../system/trie';
import type {
GitProvider,
@ -1204,11 +1204,14 @@ export class GitProviderService implements Disposable {
): Promise<
(sha: string, options?: { compact?: boolean | undefined; icons?: boolean | undefined }) => string | undefined
> {
const [{ values: branches }, { values: tags }] = await Promise.all([
const [branchesResult, tagsResult] = await Promise.allSettled([
this.getBranches(repoPath),
this.getTags(repoPath),
]);
const branches = getSettledValue(branchesResult)?.values ?? [];
const tags = getSettledValue(tagsResult)?.values ?? [];
const branchesAndTagsBySha = groupByFilterMap(
(branches as (GitBranch | GitTag)[]).concat(tags as (GitBranch | GitTag)[]),
bt => bt.sha,

Loading…
Cancel
Save