I have a node js server A that makes a request on another server B who then has to make a very complex operation that takes quite some time to finish (it triggers an algorithm that computes in about 3 minutes). I would like the server B to respond to the request with the result of the algorithm. But before the response can be sent the server A receives a response with status code 504.
How can I deal with that ? How can I avoid this 504 error because in my case it is normal that the response is slow to arrive.