I have a setup where nginx would
try_files on the nedia direcotry and serve a static image file.
If it does not find it, will call the backend, pull the file from s3, create some DB entries and then copy the file to the media directory so further calls to that media file will be served by nginx.
Generating the file can take 5 seconds.
When a X new requests will come for this file and it's not generated yet, the backend will be called X times instead of just a single time. How can I avoid this problem and hold all requests until the file is ready ?