Restart frontend if there are DB lock errors
parent
9fa6cde752
commit
c982de4b7f
8
db.py
8
db.py
|
@ -1,7 +1,7 @@
|
||||||
from config import config
|
from config import config
|
||||||
import jwt
|
import jwt
|
||||||
import logging
|
import logging
|
||||||
from os import urandom
|
from os import urandom, sleep, system
|
||||||
from pylibscrypt import scrypt_mcf
|
from pylibscrypt import scrypt_mcf
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
@ -19,7 +19,11 @@ class DB(object):
|
||||||
return self.cur.execute(*args, **kwargs)
|
return self.cur.execute(*args, **kwargs)
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
self.conn.commit()
|
try:
|
||||||
|
self.conn.commit()
|
||||||
|
except sqlite3.sqlite3.OperationalError:
|
||||||
|
system("rcctl restart frontend_daemon")
|
||||||
|
self.conn.commit()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
Loading…
Reference in New Issue