From 3de328299aa410f0bd85281916ee2a586041a9e2 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 17 Nov 2018 15:16:28 +1000 Subject: [PATCH] commit to the DB more frequently --- run.py | 1 + web.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index 1685781..f930c08 100755 --- a/run.py +++ b/run.py @@ -59,6 +59,7 @@ for row in dc.fetchall(): if tbc > int(cfg['max_time_between_checks']): tbc = cfg['max_time_between_checks'] c.execute("UPDATE data SET last_check = %s, time_between_checks = %s", (t, tbc)) + db.commit() db.commit() diff --git a/web.py b/web.py index 3a1471b..42d8c0b 100755 --- a/web.py +++ b/web.py @@ -176,7 +176,7 @@ def do_login(): pw_hashed = hashlib.sha256(pw_in.encode('utf-8')).digest() acct = request.form['acct'] session['username'] = re.match("^@([^@]+)@", acct).group(1) - session['instance'] = "https://{}".format(re.search("@([^@]+)$", acct).group(1)) + session['instance'] = "https://{}".format(re.search("@([^@]+)$", acct).group(1)) #todo: this occasionally gets "https://@username@instan.ce" dc.execute("SELECT * FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance'])) data = dc.fetchone() db.close()