fix python checks

This commit is contained in:
Cody Cutrer 2023-06-22 11:31:47 -06:00
parent cff9f69a9c
commit 46c65d60b6

View File

@ -679,14 +679,12 @@ class EventsPerSecond:
# avoid divide by zero # avoid divide by zero
if seconds == 0: if seconds == 0:
seconds = 1 seconds = 1
return ( return len(self._timestamps) / seconds
len(self._timestamps) / seconds
)
# remove aged out timestamps # remove aged out timestamps
def expire_timestamps(self, now): def expire_timestamps(self, now):
threshold = now - self._last_n_seconds threshold = now - self._last_n_seconds
while (self._timestamps and self._timestamps[0] < threshold): while self._timestamps and self._timestamps[0] < threshold:
del self._timestamps[0] del self._timestamps[0]