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