Refactor event loop for trackbert.py
- Improve conditional check for latest known event timestamp in the event loop. - Update the index of the `latest_known_event` timestamp from position 3 to position 2 for accurate comparison. - This ensures that only events with a more recent timestamp are considered.
This commit is contained in:
parent
053ae780e1
commit
69e5023994
1 changed files with 1 additions and 1 deletions
|
@ -227,7 +227,7 @@ def start_loop(db: sqlite3.Connection, api: KeyDelivery) -> Never:
|
|||
logging.debug(f"Latest upstream event for {tracking_number}: {events[0]['context']} - {events[0]['time']}")
|
||||
|
||||
for event in events:
|
||||
if latest_known_event is None or event["time"] > latest_known_event[3]:
|
||||
if latest_known_event is None or event["time"] > latest_known_event[2]:
|
||||
create_event(
|
||||
db,
|
||||
shipment_id,
|
||||
|
|
Loading…
Reference in a new issue