From b3827e49eb08435d17c4076aba2e565f62ebcef2 Mon Sep 17 00:00:00 2001 From: Charles OuGuo Date: Sat, 3 Aug 2024 20:54:02 -0400 Subject: [PATCH] In worker, skip if no new game logs are present (#340) --- ark_nova_stats/worker/app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ark_nova_stats/worker/app.py b/ark_nova_stats/worker/app.py index cf7ef24d..0e301c5e 100644 --- a/ark_nova_stats/worker/app.py +++ b/ark_nova_stats/worker/app.py @@ -37,6 +37,16 @@ def archive_logs_to_tigris( ) return None + # Next, check to see if we have new logs to include in the archive. + new_logs = GameLog.query.where( + GameLog.id > last_archive.last_game_log_id + ).count() + if new_logs == 0: + logger.debug( + f"No new logs to include since game ID {last_archive.last_game_log_id}; skipping." + ) + return None + # Retrieve all the game logs so we can serialize them. all_logs: list[GameLog] = GameLog.query.all() users: set[str] = set()