We have a REST API Get request which downloads a file from the server. This file needs to be updated whenever there is a latest version. Currently this is done by deleting the existing file and moving the latest file as new one.
As the file is being held due to high traffic nature of service, deletion of file is not happening. This results in users getting older version of file.
How to re-design the system to update the file to its latest version while the file is being constantly accessed?
For deleting the file, we use the following
File.Delete(filePath)
For moving the file, we use the following
File.Move(tempFilePath, filePath);