DEV Community

Discussion on: Timeout with a third party library or another server - How to handle?

Collapse
 
brandinchiu profile image
Brandin Chiu • Edited

For processes that you know specifically have a long processing time, you can use a combination of synchronous and asynchronous messaging and polling.

For example, when you complete a git merge in Bitbucket, the client (website) sends a request to the api server to merge the request.

The api server replies telling the client that it has received the request and is processing.

In the meantime, Bitbucket continuously polls a different API with a processID given to it in the prior request: each time asking if the job is done yet. Once it receives an affirmative, it updates the view.

This kind of scenario can be done server to server just as easily.

I will also vouch for a message queue solution as suggested by Erick as a great alternative.

Collapse
 
nav_devl profile image
Naveen Honest Raj

Thanks Brandin. This is something new that I learnt today.