Fix comment to be more accurate
This commit is contained in:
@@ -8,7 +8,7 @@ import { getErrorMessage } from "../pure/helpers-pure";
|
|||||||
* same time.
|
* same time.
|
||||||
*/
|
*/
|
||||||
export abstract class Discovery<T> extends DisposableObject {
|
export abstract class Discovery<T> extends DisposableObject {
|
||||||
private retry = false;
|
private restartWhenFinished = false;
|
||||||
private currentDiscoveryPromise: Promise<void> | undefined;
|
private currentDiscoveryPromise: Promise<void> | undefined;
|
||||||
|
|
||||||
constructor(private readonly name: string) {
|
constructor(private readonly name: string) {
|
||||||
@@ -48,7 +48,7 @@ export abstract class Discovery<T> extends DisposableObject {
|
|||||||
|
|
||||||
if (this.currentDiscoveryPromise !== undefined) {
|
if (this.currentDiscoveryPromise !== undefined) {
|
||||||
// There's already a discovery operation in progress. Tell it to restart when it's done.
|
// There's already a discovery operation in progress. Tell it to restart when it's done.
|
||||||
this.retry = true;
|
this.restartWhenFinished = true;
|
||||||
} else {
|
} else {
|
||||||
// No discovery in progress, so start one now.
|
// No discovery in progress, so start one now.
|
||||||
this.currentDiscoveryPromise = this.launchDiscovery();
|
this.currentDiscoveryPromise = this.launchDiscovery();
|
||||||
@@ -72,13 +72,13 @@ export abstract class Discovery<T> extends DisposableObject {
|
|||||||
results = undefined;
|
results = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.retry) {
|
if (this.restartWhenFinished) {
|
||||||
// Another refresh request came in while we were still running a previous discovery
|
// Another refresh request came in while we were still running a previous discovery
|
||||||
// operation. Since the discovery results we just computed are now stale, we'll launch
|
// operation. Since the discovery results we just computed are now stale, we'll launch
|
||||||
// another discovery operation instead of updating.
|
// another discovery operation instead of updating.
|
||||||
// Note that by doing this inside of `finally`, we will relaunch discovery even if the
|
// We want to relaunch discovery regardless of if the initial discovery operation
|
||||||
// initial discovery operation failed.
|
// succeeded or failed.
|
||||||
this.retry = false;
|
this.restartWhenFinished = false;
|
||||||
await this.launchDiscovery();
|
await this.launchDiscovery();
|
||||||
} else {
|
} else {
|
||||||
this.currentDiscoveryPromise = undefined;
|
this.currentDiscoveryPromise = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user