소스 검색

Removes needless closures on setTimeout

main
Eric Amodio 2 년 전
부모
커밋
a8ad820342
9개의 변경된 파일10개의 추가작업 그리고 16개의 파일을 삭제
  1. +1
    -1
      src/commands/gitCommands.ts
  2. +1
    -1
      src/container.ts
  3. +1
    -3
      src/env/node/git/localGitProvider.ts
  4. +3
    -3
      src/extension.ts
  5. +1
    -1
      src/plus/subscription/serverConnection.ts
  6. +1
    -1
      src/plus/subscription/subscriptionService.ts
  7. +0
    -4
      src/system/function.ts
  8. +1
    -1
      src/webviews/webviewBase.ts
  9. +1
    -1
      src/webviews/webviewViewBase.ts

+ 1
- 1
src/commands/gitCommands.ts 파일 보기

@ -178,7 +178,7 @@ export class GitCommandsCommand extends Command {
): Promise<QuickPickStep<QuickPickItem> | QuickInputStep | CustomStep | undefined> { ): Promise<QuickPickStep<QuickPickItem> | QuickInputStep | CustomStep | undefined> {
const stepOrTimeout = await Promise.race([ const stepOrTimeout = await Promise.race([
stepPromise, stepPromise,
new Promise<typeof showLoadingSymbol>(resolve => setTimeout(() => resolve(showLoadingSymbol), 250)),
new Promise<typeof showLoadingSymbol>(resolve => setTimeout(resolve, 250, showLoadingSymbol)),
]); ]);
if (stepOrTimeout !== showLoadingSymbol) { if (stepOrTimeout !== showLoadingSymbol) {

+ 1
- 1
src/container.ts 파일 보기

@ -653,7 +653,7 @@ export class Container {
on: true, on: true,
}; };
// Make sure to delay the execution by a bit so that the configuration changes get propagated first // Make sure to delay the execution by a bit so that the configuration changes get propagated first
setTimeout(() => executeCommand(command!, commandArgs), 50);
setTimeout(executeCommand, 50, command, commandArgs);
} }
} }

+ 1
- 3
src/env/node/git/localGitProvider.ts 파일 보기

@ -331,9 +331,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
const location = await any<GitLocation>(findGitPromise, findGitFromSCMPromise); const location = await any<GitLocation>(findGitPromise, findGitFromSCMPromise);
// Save the found git path, but let things settle first to not impact startup performance // Save the found git path, but let things settle first to not impact startup performance
setTimeout(() => {
void this.container.storage.storeWorkspace('gitPath', location.path);
}, 1000);
setTimeout(() => void this.container.storage.storeWorkspace('gitPath', location.path), 1000);
if (scope != null) { if (scope != null) {
scope.exitDetails = ` ${GlyphChars.Dot} Git (${location.version}) found in ${ scope.exitDetails = ` ${GlyphChars.Dot} Git (${location.version}) found in ${

+ 3
- 3
src/extension.ts 파일 보기

@ -65,7 +65,7 @@ export async function activate(context: ExtensionContext): Promise
sw.stop({ message: ' was NOT activated because GitLens is also enabled' }); sw.stop({ message: ' was NOT activated because GitLens is also enabled' });
// If we don't use a setTimeout here this notification will get lost for some reason // If we don't use a setTimeout here this notification will get lost for some reason
setTimeout(() => void showInsidersErrorMessage(), 0);
setTimeout(showInsidersErrorMessage, 0);
return undefined; return undefined;
} }
@ -86,7 +86,7 @@ export async function activate(context: ExtensionContext): Promise
}); });
// If we don't use a setTimeout here this notification will get lost for some reason // If we don't use a setTimeout here this notification will get lost for some reason
setTimeout(() => void showPreReleaseExpiredErrorMessage(gitlensVersion, insiders), 0);
setTimeout(showPreReleaseExpiredErrorMessage, 0, gitlensVersion, insiders);
return undefined; return undefined;
} }
@ -213,7 +213,7 @@ export async function activate(context: ExtensionContext): Promise
endTime, endTime,
); );
setTimeout(() => uninstallDeprecatedAuthentication(), 25000);
setTimeout(uninstallDeprecatedAuthentication, 25000);
return Promise.resolve(api); return Promise.resolve(api);
} }

+ 1
- 1
src/plus/subscription/serverConnection.ts 파일 보기

@ -138,7 +138,7 @@ export class ServerConnection implements Disposable {
new Promise<string>((_, reject) => new Promise<string>((_, reject) =>
this._cancellationSource?.token.onCancellationRequested(() => reject('Cancelled')), this._cancellationSource?.token.onCancellationRequested(() => reject('Cancelled')),
), ),
new Promise<string>((_, reject) => setTimeout(() => reject('Cancelled'), 120000)),
new Promise<string>((_, reject) => setTimeout(reject, 120000, 'Cancelled')),
]).finally(() => { ]).finally(() => {
this._cancellationSource?.cancel(); this._cancellationSource?.cancel();
this._cancellationSource?.dispose(); this._cancellationSource?.dispose();

+ 1
- 1
src/plus/subscription/subscriptionService.ts 파일 보기

@ -532,7 +532,7 @@ export class SubscriptionService implements Disposable {
const validating = this.checkInAndValidateCore(session); const validating = this.checkInAndValidateCore(session);
const result = await Promise.race([ const result = await Promise.race([
validating, validating,
new Promise<boolean>(resolve => setTimeout(() => resolve(true), 3000)),
new Promise<boolean>(resolve => setTimeout(resolve, 3000, true)),
]); ]);
if (result) { if (result) {

+ 0
- 4
src/system/function.ts 파일 보기

@ -173,7 +173,3 @@ export async function sequentialize unknown>(
export function szudzikPairing(x: number, y: number): number { export function szudzikPairing(x: number, y: number): number {
return x >= y ? x * x + x + y : x + y * y; return x >= y ? x * x + x + y : x + y * y;
} }
export async function wait(ms: number) {
await new Promise(resolve => setTimeout(resolve, ms));
}

+ 1
- 1
src/webviews/webviewBase.ts 파일 보기

@ -363,7 +363,7 @@ export abstract class WebviewBase implements Disposable {
// It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang // It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang
return Promise.race<boolean>([ return Promise.race<boolean>([
this._panel.webview.postMessage(message), this._panel.webview.postMessage(message),
new Promise<boolean>(resolve => setTimeout(() => resolve(false), 5000)),
new Promise<boolean>(resolve => setTimeout(resolve, 5000, false)),
]); ]);
} }
} }

+ 1
- 1
src/webviews/webviewViewBase.ts 파일 보기

@ -337,7 +337,7 @@ export abstract class WebviewViewBase implements
// It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang // It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang
return Promise.race<boolean>([ return Promise.race<boolean>([
this._view.webview.postMessage(message), this._view.webview.postMessage(message),
new Promise<boolean>(resolve => setTimeout(() => resolve(false), 5000)),
new Promise<boolean>(resolve => setTimeout(resolve, 5000, false)),
]); ]);
} }
} }

불러오는 중...
취소
저장