Fix Array slice error
This commit is contained in:
+6
-4
@@ -206,13 +206,15 @@ class FrigateCounterService:
|
||||
now = datetime.now().isoformat()
|
||||
|
||||
""" START - Carry last 50 previous counted_ids into next batch """
|
||||
counted_ids = []
|
||||
if self.previous_state is not None:
|
||||
try:
|
||||
counted_ids = self.previous_state["counted_event_ids"][-50:0]
|
||||
counted_ids = self.previous_state["counted_event_ids"][-50:]
|
||||
except:
|
||||
counted_ids = []
|
||||
else:
|
||||
counted_ids = []
|
||||
|
||||
# Print
|
||||
#self.logger.info(counted_ids)
|
||||
|
||||
self.current_state = {
|
||||
"counting_date": counting_date,
|
||||
@@ -339,7 +341,6 @@ class FrigateCounterService:
|
||||
self.end_batch()
|
||||
|
||||
def end_batch(self):
|
||||
self.previous_state = self.current_state
|
||||
with self.state_lock:
|
||||
self._end_batch_locked()
|
||||
|
||||
@@ -347,6 +348,7 @@ class FrigateCounterService:
|
||||
if self.current_state is None:
|
||||
return
|
||||
|
||||
self.previous_state = self.current_state
|
||||
state = self.current_state
|
||||
|
||||
""" Check Duration """
|
||||
|
||||
Reference in New Issue
Block a user