Skip to content

Commit b50d3a0

Browse files
Clarify snapshot refresh promise flow
Use async and await without changing refresh behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6b12d843-8011-4bfc-9ba9-f75761eadee2
1 parent 3bda932 commit b50d3a0

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src/managers/builtin/inlineScript/envManager.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,19 +369,18 @@ export class InlineScriptEnvManager implements EnvironmentManager, Disposable {
369369
return followUp;
370370
}
371371

372-
private startSnapshotRefreshAfter(sharedPass: DiscoveryRefreshPass): Promise<boolean> {
373-
return sharedPass.promise.then(() => {
374-
if (this.disposed || !this.activationDiscoveryActive) {
375-
return false;
376-
}
377-
const pending = this.pendingRefresh;
378-
if (pending && pending !== sharedPass) {
379-
return pending.checksForSnapshotChanges
380-
? pending.promise
381-
: this.startSnapshotRefreshAfter(pending);
382-
}
383-
return this.startRefreshPass(true);
384-
});
372+
private async startSnapshotRefreshAfter(sharedPass: DiscoveryRefreshPass): Promise<boolean> {
373+
await sharedPass.promise;
374+
if (this.disposed || !this.activationDiscoveryActive) {
375+
return false;
376+
}
377+
const pending = this.pendingRefresh;
378+
if (pending && pending !== sharedPass) {
379+
return pending.checksForSnapshotChanges
380+
? pending.promise
381+
: this.startSnapshotRefreshAfter(pending);
382+
}
383+
return this.startRefreshPass(true);
385384
}
386385

387386
private runActivationDiscoveryPass(): void {

0 commit comments

Comments
 (0)