Add 1 second to the time-formatted date if file exists?
This might be a hack-ey way to solve a race condition. Better ideas?
Problem
If AudioServer is sent 2 split events in 1 second, and there is a time-based filename that includes the seconds, then it will fail since the file is already open.
Idea
- Put the "get filename" code into a function.
- If
newFile.exists()
on REST API request, then sleep for 1 second. - Run "get filename" function again, and try to start writing to file.
- If that still doesn't work, then log error, and send back
500
error code to request, with JSON:{"errors": [ { "title": "Failed: Output File Exists", "detail": "Could not start recording. Output filename already exists." } ] }
Edited by Travis