0

I have a long running server call, it takes like 30-40 mins. My angular front end timeouts. How can I increase the default timeout for this service call ?

  method1(id: number): Promise<number> {
    const body= JSON.stringify(id);
    return sendReq.post(url, body)
    .then((res) => res)
    .catch((err: any) => {
    });
  }

I have seen a property called timeout but, not sure how to apply that into my code above. Can someone help me out.

Sharon Watinsan
  • 9,620
  • 31
  • 96
  • 140
  • I want the Timeout to Only affect the above service method, not all the methods in the project. – Sharon Watinsan Apr 25 '19 at 18:16
  • The top answer states: "Since timeout value is scalar, it can be safely provided as a custom header to the interceptor, where it can be decided if it's default or specific timeout that should be applied via RxJS timeout operator " https://stackoverflow.com/a/45986060/9766768 – Friso Hoekstra Apr 25 '19 at 18:19

1 Answers1

0

Keeping promise or waiting for callback for 30-40 minutes is not a great idea in general. It is much better for backend to modify some flag when job completed and for frontend to check periodically for this flag.

You may use angular $timeout for this.

Aleksey
  • 51
  • 3