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.

2
  • I want the Timeout to Only affect the above service method, not all the methods in the project. Commented Apr 25, 2019 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 " stackoverflow.com/a/45986060/9766768 Commented Apr 25, 2019 at 18:19

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.