commit manually since autocommit=True might only work for new keys

master
float-trip 2023-07-17 01:44:14 +00:00
parent 1f602aa14a
commit 826a631fd1
2 changed files with 2 additions and 5 deletions

View File

@ -99,6 +99,7 @@ class DramaClient:
return []
db["last_processed_id"] = max(c["id"] for c in comments)
db.commit()
# New comments may have pushed others to page n+1 while fetching.
deduped_comments = {c["id"]: c for c in comments}.values()

View File

@ -12,9 +12,5 @@ def load_config():
return yaml.safe_load(f)
def open_database():
return SqliteDict("db.sqlite", autocommit=True)
config = load_config()
db = open_database()
db = SqliteDict(f"{config['data_dir']}/db.sqlite", autocommit=True)