Skip to content

Commit 4d2e632

Browse files
committed
Avoids dangling promises
1 parent 79783b0 commit 4d2e632

23 files changed

+49
-49
lines changed

src/ai/aiProviderService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,12 @@ async function confirmAIProviderToS<Provider extends AIProviders>(
566566
if (result === accept) return true;
567567

568568
if (result === acceptWorkspace) {
569-
void storage.storeWorkspace(`confirm:ai:tos:${model.provider.id}`, true);
569+
void storage.storeWorkspace(`confirm:ai:tos:${model.provider.id}`, true).catch();
570570
return true;
571571
}
572572

573573
if (result === acceptAlways) {
574-
void storage.store(`confirm:ai:tos:${model.provider.id}`, true);
574+
void storage.store(`confirm:ai:tos:${model.provider.id}`, true).catch();
575575
return true;
576576
}
577577

@@ -642,7 +642,7 @@ export async function getOrPromptApiKey(
642642

643643
if (!apiKey) return undefined;
644644

645-
void storage.storeSecret(`gitlens.${provider.id}.key`, apiKey);
645+
void storage.storeSecret(`gitlens.${provider.id}.key`, apiKey).catch();
646646
}
647647

648648
return apiKey;

src/avatars.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _onDidFetchAvatar.event(
3636
),
3737
]
3838
: undefined;
39-
void Container.instance.storage.store('avatars', avatars);
39+
void Container.instance.storage.store('avatars', avatars).catch();
4040
}, 1000),
4141
);
4242

src/env/node/git/localGitProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
467467

468468
const location = await any<GitLocation>(findGitPromise, findGitFromSCMPromise);
469469
// Save the found git path, but let things settle first to not impact startup performance
470-
setTimeout(() => void this.container.storage.storeWorkspace('gitPath', location.path), 1000);
470+
setTimeout(() => void this.container.storage.storeWorkspace('gitPath', location.path).catch(), 1000);
471471

472472
if (scope != null) {
473473
setLogScopeExit(

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ export async function activate(context: ExtensionContext): Promise<GitLensApi |
189189

190190
void showWhatsNew(container, gitlensVersion, prerelease, previousVersion);
191191

192-
void storage.store(prerelease ? 'preVersion' : 'version', gitlensVersion);
192+
void storage.store(prerelease ? 'preVersion' : 'version', gitlensVersion).catch();
193193

194194
// Only update our synced version if the new version is greater
195195
if (syncedVersion == null || compare(gitlensVersion, syncedVersion) === 1) {
196-
void storage.store(prerelease ? 'synced:preVersion' : 'synced:version', gitlensVersion);
196+
void storage.store(prerelease ? 'synced:preVersion' : 'synced:version', gitlensVersion).catch();
197197
}
198198

199199
if (logLevel === 'debug') {

src/git/gitProviderService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ export class GitProviderService implements Disposable {
939939
private updateVisibilityCache(key: string, visibilityInfo: RepositoryVisibilityInfo): void {
940940
this.ensureRepoVisibilityCache();
941941
this._repoVisibilityCache?.set(key, visibilityInfo);
942-
void this.container.storage.store('repoVisibility', Array.from(this._repoVisibilityCache!.entries()));
942+
void this.container.storage.store('repoVisibility', Array.from(this._repoVisibilityCache!.entries())).catch();
943943
}
944944

945945
@debug()

src/plus/gk/account/subscriptionService.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,11 +1096,13 @@ export class SubscriptionService implements Disposable {
10961096
private storeCheckInData(data: GKCheckInResponse): void {
10971097
if (data.user?.id == null) return;
10981098

1099-
void this.container.storage.store(`gk:${data.user.id}:checkin`, {
1100-
v: 1,
1101-
timestamp: Date.now(),
1102-
data: data,
1103-
});
1099+
void this.container.storage
1100+
.store(`gk:${data.user.id}:checkin`, {
1101+
v: 1,
1102+
timestamp: Date.now(),
1103+
data: data,
1104+
})
1105+
.catch();
11041106
}
11051107

11061108
private async loadStoredCheckInData(userId: string): Promise<GKCheckInResponse | undefined> {
@@ -1373,7 +1375,7 @@ export class SubscriptionService implements Disposable {
13731375
// If the previous and new subscriptions are exactly the same, kick out
13741376
if (matches) {
13751377
if (options?.store) {
1376-
void this.storeSubscription(subscription);
1378+
void this.storeSubscription(subscription).catch();
13771379
}
13781380
return;
13791381
}
@@ -1391,7 +1393,7 @@ export class SubscriptionService implements Disposable {
13911393
});
13921394

13931395
if (options?.store !== false) {
1394-
void this.storeSubscription(subscription);
1396+
void this.storeSubscription(subscription).catch();
13951397
}
13961398

13971399
this._subscription = subscription;

src/plus/integrations/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export abstract class IntegrationBase<
200200
// Don't store the disconnected flag if silently disconnecting or disconnecting this only for
201201
// this current VS Code session (will be re-connected on next restart)
202202
if (!options?.currentSessionOnly && !options?.silent) {
203-
void this.container.storage.storeWorkspace(this.connectedKey, false);
203+
void this.container.storage.storeWorkspace(this.connectedKey, false).catch();
204204
}
205205

206206
this._onDidChange.fire();

src/plus/launchpad/launchpad.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class LaunchpadCommand extends QuickCommand<State> {
161161
args?.source === 'launchpad-indicator' &&
162162
container.storage.get('launchpad:indicator:hasInteracted') == null
163163
) {
164-
void container.storage.store('launchpad:indicator:hasInteracted', new Date().toISOString());
164+
void container.storage.store('launchpad:indicator:hasInteracted', new Date().toISOString()).catch();
165165
}
166166

167167
this.source = { source: args?.source ?? 'commandPalette' };

src/plus/launchpad/launchpadIndicator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ export class LaunchpadIndicator implements Disposable {
584584

585585
const hasLoaded = this.container.storage.get('launchpad:indicator:hasLoaded') ?? false;
586586
if (!hasLoaded) {
587-
void this.container.storage.store('launchpad:indicator:hasLoaded', true);
587+
void this.container.storage.store('launchpad:indicator:hasLoaded', true).catch();
588588
this.container.telemetry.sendEvent('launchpad/indicator/firstLoad');
589589
}
590590
}

src/plus/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export async function confirmDraftStorage(container: Container): Promise<boolean
158158
);
159159

160160
if (result === accept) {
161-
void container.storage.store('confirm:draft:storage', true);
161+
void container.storage.store('confirm:draft:storage', true).catch();
162162
return true;
163163
}
164164

0 commit comments

Comments
 (0)