From 1138e2b3a83c90df12c52e876e7591ffd9729b12 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 17 Dec 2019 10:23:17 -0800 Subject: [PATCH] Robustify against items without created or ttl --- inquisitor/importer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inquisitor/importer.py b/inquisitor/importer.py index bf37ff1..d17ac87 100644 --- a/inquisitor/importer.py +++ b/inquisitor/importer.py @@ -103,7 +103,10 @@ def update_source(source_name, fetch_new): # when they are both inactive and past their ttl date. now = timestamp.now() for prior_id, prior_item in prior_items.items(): - ttl_date = prior_item['created'] + prior_item['ttl'] + if 'created' in prior_item and 'ttl' in prior_item: + ttl_date = prior_item['created'] + prior_item['ttl'] + else: + ttl_date = 0 if not prior_item['active'] and ttl_date < now: del_count += 1 file_path = os.path.join(DUNGEON_PATH, prior_item['source'], prior_item['id'] + ".item")