I have a REST api that launch a heavy calculation on the serveur (it tikes a few seconds). For that I'm returning 202 (ACCEPTED) http code to the client, which will not expect a returning value. Ok so far.
What will I return for another client how calls this url while the process (launched by the first call) is not terminated ?
This second call will not be processed, it will be ignored and the client must try again later.
If you insist on the current behavior, then you'll return 503. This tells the (standard compliant) client that your server is temporarily overloaded, and it can retry later (you can even hint when it can on Retry-After header. While standard-compliant, you'll only want to do this if queuing the process requested by the second call later is impossible, perhaps because the internal state will have changed so the second call is invalid. If it's possible to just queue the process with an identical result as when the client manually retry the call, then just return 202.