mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
Catch FileNotFoundError when getting file system stats (#5056)
This commit is contained in:
parent
54bfa4679c
commit
2d76363da5
@ -884,6 +884,10 @@ def get_recordings_storage_usage():
|
||||
current_app.stats_tracking,
|
||||
current_app.hwaccel_errors,
|
||||
)["service"]["storage"][RECORD_DIR]
|
||||
|
||||
if not recording_stats:
|
||||
return jsonify({})
|
||||
|
||||
total_mb = recording_stats["total"]
|
||||
|
||||
camera_usages: dict[
|
||||
|
@ -241,7 +241,11 @@ def stats_snapshot(
|
||||
}
|
||||
|
||||
for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]:
|
||||
try:
|
||||
storage_stats = shutil.disk_usage(path)
|
||||
except FileNotFoundError:
|
||||
stats["service"]["storage"][path] = {}
|
||||
|
||||
stats["service"]["storage"][path] = {
|
||||
"total": round(storage_stats.total / 1000000, 1),
|
||||
"used": round(storage_stats.used / 1000000, 1),
|
||||
|
Loading…
Reference in New Issue
Block a user