Friends, are scratching their heads over some non-trivial problem.
The point: there is file sharing. Storage servers are equipped with SSD disks. There is a plan to put on the SSD frequently accessed files and give them to them. Counting the popularity of the file, copying and deletion are no longer popular (the size of the SSD, alas, limited) would be handled by the script in automatic mode.
Problem — if the script worked and deleted the file in the moment when someone downloads, the connection terminates with an error.
Hover over the idea how to implement any number of locks active files to delete, or maybe there is some magic way to make nginx to look for the file in another location (with HDD) after its disappearance from its current location? The latter, of course, sounds more like a fairy tale, but you never know...