mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-05-30 01:16:42 +02: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.stats_tracking,
|
||||||
current_app.hwaccel_errors,
|
current_app.hwaccel_errors,
|
||||||
)["service"]["storage"][RECORD_DIR]
|
)["service"]["storage"][RECORD_DIR]
|
||||||
|
|
||||||
|
if not recording_stats:
|
||||||
|
return jsonify({})
|
||||||
|
|
||||||
total_mb = recording_stats["total"]
|
total_mb = recording_stats["total"]
|
||||||
|
|
||||||
camera_usages: dict[
|
camera_usages: dict[
|
||||||
|
@ -241,7 +241,11 @@ def stats_snapshot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]:
|
for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]:
|
||||||
storage_stats = shutil.disk_usage(path)
|
try:
|
||||||
|
storage_stats = shutil.disk_usage(path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
stats["service"]["storage"][path] = {}
|
||||||
|
|
||||||
stats["service"]["storage"][path] = {
|
stats["service"]["storage"][path] = {
|
||||||
"total": round(storage_stats.total / 1000000, 1),
|
"total": round(storage_stats.total / 1000000, 1),
|
||||||
"used": round(storage_stats.used / 1000000, 1),
|
"used": round(storage_stats.used / 1000000, 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user