Skip to content

Commit

Permalink
fix consiquences of orphaned 0 byte wav files
Browse files Browse the repository at this point in the history
  • Loading branch information
dibbz committed Mar 1, 2024
1 parent 814466e commit cfafae9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions birdcage_backend/app/stream_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ def sigterm_handler(signal_number, frame):

else:
print('FAIL')
# 0 bytes from failed ffmpegs causing a loop
if os.stat(file_path).st_size == 0:
os.remove(file_path)
print("Removed " + file_path + " as it was 0 bytes and failed", flush=True)


# Clean up recordings once per day.
if (datetime.now() - last_cleanup_time) > timedelta(days=1):
Expand Down

0 comments on commit cfafae9

Please sign in to comment.