Robustify against items without created or ttl
This commit is contained in:
parent
3919346cb4
commit
1138e2b3a8
|
@ -103,7 +103,10 @@ def update_source(source_name, fetch_new):
|
||||||
# when they are both inactive and past their ttl date.
|
# when they are both inactive and past their ttl date.
|
||||||
now = timestamp.now()
|
now = timestamp.now()
|
||||||
for prior_id, prior_item in prior_items.items():
|
for prior_id, prior_item in prior_items.items():
|
||||||
|
if 'created' in prior_item and 'ttl' in prior_item:
|
||||||
ttl_date = prior_item['created'] + prior_item['ttl']
|
ttl_date = prior_item['created'] + prior_item['ttl']
|
||||||
|
else:
|
||||||
|
ttl_date = 0
|
||||||
if not prior_item['active'] and ttl_date < now:
|
if not prior_item['active'] and ttl_date < now:
|
||||||
del_count += 1
|
del_count += 1
|
||||||
file_path = os.path.join(DUNGEON_PATH, prior_item['source'], prior_item['id'] + ".item")
|
file_path = os.path.join(DUNGEON_PATH, prior_item['source'], prior_item['id'] + ".item")
|
||||||
|
|
Loading…
Reference in New Issue