Browse Source

commit to the DB more frequently

Lynne Megido 3 months ago
parent
commit
3de328299a
Signed by: Lynne <thecoolone3@gmail.com> GPG Key ID: FB7B970303ACE499
2 changed files with 2 additions and 1 deletions
  1. 1
    0
      run.py
  2. 1
    1
      web.py

+ 1
- 0
run.py View File

@@ -59,6 +59,7 @@ for row in dc.fetchall():
59 59
 				if tbc > int(cfg['max_time_between_checks']):
60 60
 					tbc = cfg['max_time_between_checks']
61 61
 				c.execute("UPDATE data SET last_check = %s, time_between_checks = %s", (t, tbc))
62
+			db.commit()
62 63
 
63 64
 db.commit()
64 65
 				

+ 1
- 1
web.py View File

@@ -176,7 +176,7 @@ def do_login():
176 176
 	pw_hashed = hashlib.sha256(pw_in.encode('utf-8')).digest()
177 177
 	acct = request.form['acct']
178 178
 	session['username'] = re.match("^@([^@]+)@", acct).group(1)
179
-	session['instance'] = "https://{}".format(re.search("@([^@]+)$", acct).group(1))
179
+	session['instance'] = "https://{}".format(re.search("@([^@]+)$", acct).group(1)) #todo: this occasionally gets "https://@username@instan.ce"
180 180
 	dc.execute("SELECT * FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance']))
181 181
 	data = dc.fetchone()
182 182
 	db.close()

Loading…
Cancel
Save