-1

I have some frontend code, which sends out an HTTPClient.get request to a Lambda function I have.

It's working fine. But I started thinking about how to explore the limits of HTTPClient and fell short a bit.

public httpGet(url: string): Observable<dataMessageApi.scheduledEvent.ScheduledEvent[]> {
    const httpOptions = {
        headers: new HttpHeaders({ 'x-api-key': environment.ticketmasterServiceApiKey })
    };
    console.log('ScheduledEventsService httpGet: %o', url);
    return (
        this.httpClient
            .get<dataMessageApi.scheduledEvent.ScheduledEvent[]>(
                'https://jsonplaceholder.typicode.com/todos/1/?_delay=100000000',
                httpOptions
            )
            .pipe(timeout(45000)) // redundant
            .pipe(catchError(this.handleError)) // happens 30,000 > n > 31,000 ms in
    );
}

I've been debugging by just running on localhost:42000 and checking my browser console logs.

I have noticed that my error gets logged between 30,000ms > n > 31,000ms

And that this can't be increased via the .pipe(timeout(45000)) line.

What is dictating this 30s timeout? I can't find any documentation on this issue.

Is it the browser? Or HTTPClient? Or something else I'm not understanding correctly?

I have tried on Chrome and Edge.

Thanks :)!

cien
  • 43
  • 6

1 Answers1

0

You are right, timeout has no effect above 30000ms. According to the link below, this is a limitation of the browser. Increase timeout limit in Google Chrome Alternatively you can try rxjs operator retry() to repeat the http request.