forked from ticketfrei/ticketfrei
reduce explicit db commits
This commit is contained in:
parent
9a262514fd
commit
d7aea928d1
4
db.py
4
db.py
|
|
@ -27,13 +27,15 @@ class DB(object):
|
|||
break
|
||||
except sqlite3.OperationalError as error:
|
||||
# another thread may be writing, give it a chance to finish
|
||||
sleep(0.5)
|
||||
sleep(1)
|
||||
logger.exception()
|
||||
if time() - start_time > 5:
|
||||
# if it takes this long, something is wrong
|
||||
system("rcctl restart frontend_daemon")
|
||||
logger.warning("frontend_daemon is getting restarted")
|
||||
self.conn.commit()
|
||||
elif time() - start_time > 10:
|
||||
return
|
||||
|
||||
def close(self):
|
||||
self.conn.close()
|
||||
|
|
|
|||
3
user.py
3
user.py
|
|
@ -158,7 +158,6 @@ schlitz
|
|||
def toot_witness(self, toot_uri):
|
||||
db.execute("INSERT INTO seen_toots (toot_uri, user_id) VALUES (?,?);",
|
||||
(toot_uri, self.uid))
|
||||
db.commit()
|
||||
|
||||
def get_seen_tg(self):
|
||||
db.execute("SELECT tg_id FROM seen_telegrams WHERE user_id = ?;",
|
||||
|
|
@ -168,7 +167,6 @@ schlitz
|
|||
def save_seen_tg(self, tg_id):
|
||||
db.execute("UPDATE seen_telegrams SET tg_id = ? WHERE user_id = ?;",
|
||||
(tg_id, self.uid))
|
||||
db.commit()
|
||||
|
||||
def get_mailinglist(self):
|
||||
db.execute("SELECT email FROM mailinglist WHERE user_id = ?;", (self.uid, ))
|
||||
|
|
@ -181,7 +179,6 @@ schlitz
|
|||
def save_seen_mail(self, mail_date):
|
||||
db.execute("UPDATE seen_mail SET mail_date = ? WHERE user_id = ?;",
|
||||
(mail_date, self.uid))
|
||||
db.commit()
|
||||
|
||||
def set_trigger_words(self, patterns):
|
||||
db.execute("UPDATE triggerpatterns SET patterns = ? WHERE user_id = ?;",
|
||||
|
|
|
|||
Loading…
Reference in a new issue