Python/Flask: only one user can call a endpoint at one time
You have some approaches for this problem:
1 - You can create a session object, save a flag in the object and check if the endpoint is already running and respond accordingly.
2 - Flag on the database, check if the endpoint is already running and respond accordingly.
I have a API build using Python/Flask, and I have a endpoint called /build-task that called by the system, and this endpoint takes about 30 minutes to run. 
My question is that how do I lock the /build-task endpoint when it's started and running already? So so other user, or system CANNOT call this endpoint.