From 7d8df2761df6423e35c77ca6ac0749a111ff93f7 Mon Sep 17 00:00:00 2001 From: Aleksey Lobanov Date: Sat, 16 Jan 2021 22:07:44 +0300 Subject: [PATCH] scrape: Fix for saving last id --- scrape_repos.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrape_repos.py b/scrape_repos.py index c5459c1..c77013e 100644 --- a/scrape_repos.py +++ b/scrape_repos.py @@ -51,6 +51,7 @@ def get_last_id() -> int: def save_last_id(val: int): + logging.info(f"Saving last_id={val}") with open(SCRAPING_LAST_ID_PATH, "w") as f: f.write(str(val)) @@ -71,7 +72,7 @@ def main(): send_repository(rabbit_channel, json.dumps(repository_data).encode("utf-8")) last_item_id = repository_data["id"] - if processed_count % SAVE_ID_EVERY: + if processed_count % SAVE_ID_EVERY == 0: save_last_id(last_item_id) except RateLimitExceededException: save_last_id(last_item_id)