Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmyers committed Dec 19, 2024
1 parent b6b79be commit 93f58f1
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Inject, Injectable } from '@angular/core';
import { lastValueFrom, Observable, Subject } from 'rxjs';
import { firstValueFrom, Observable, Subject } from 'rxjs';
import { filter, take } from 'rxjs/operators';
import { CONSOLE, ConsoleInterface } from './browser-globals';
import { CommandErrorCode, CommandService } from './command.service';
Expand Down Expand Up @@ -96,7 +96,7 @@ export class RetryingRequest<T> {

private async invoke(options: FetchOptions): Promise<T | undefined> {
while (!this.canceled && this.status !== 'complete') {
const online = await lastValueFrom(this.online$.pipe(take(1)));
const online = await firstValueFrom(this.online$);
if (online !== true) {
this.status = 'offline';
await this.uponOnline();
Expand Down Expand Up @@ -124,12 +124,7 @@ export class RetryingRequest<T> {
}

private async uponOnline(): Promise<void> {
await lastValueFrom(
this.online$.pipe(
filter(isOnline => isOnline),
take(1)
)
);
await firstValueFrom(this.online$.pipe(filter(isOnline => isOnline)));
}

private isNetworkError(error: unknown): boolean {
Expand Down

0 comments on commit 93f58f1

Please sign in to comment.