Cap storage bandwidth

This commit is contained in:
Nicolas Mowen 2024-12-12 11:54:59 -07:00
parent ed2e1f3f72
commit a474fa1f5e

View File

@ -17,6 +17,8 @@ bandwidth_equation = Recordings.segment_size / (
Recordings.end_time - Recordings.start_time Recordings.end_time - Recordings.start_time
) )
MAX_CALCULATED_BANDWIDTH = 10000 # 10Gb/hr
class StorageMaintainer(threading.Thread): class StorageMaintainer(threading.Thread):
"""Maintain frigates recording storage.""" """Maintain frigates recording storage."""
@ -52,6 +54,12 @@ class StorageMaintainer(threading.Thread):
* 3600, * 3600,
2, 2,
) )
if bandwidth > MAX_CALCULATED_BANDWIDTH:
logger.warning(
f"{camera} has a bandwidth of {bandwidth} MB/hr which exceeds the expected maximum. This typically indicates an issue with the cameras recordings."
)
bandwidth = MAX_CALCULATED_BANDWIDTH
except TypeError: except TypeError:
bandwidth = 0 bandwidth = 0