1. fix: mysql query not commit; 2. fix: if replay folder not created, the log page can not show.

pull/32/head
Apex Liu 2017-05-24 18:12:12 +00:00
parent ac09bfa5b5
commit 41240fd8a7
2 changed files with 9 additions and 3 deletions

View File

@ -433,6 +433,7 @@ class TPMysqlPool(TPDatabasePool):
try:
cursor.execute(sql)
db_ret = cursor.fetchall()
conn.commit()
return db_ret
except Exception as e:
log.e('[mysql] _do_query() failed: {}\n'.format(e.__str__()))
@ -457,6 +458,7 @@ class TPMysqlPool(TPDatabasePool):
try:
cursor.execute('SELECT LAST_INSERT_ID();')
db_ret = cursor.fetchall()
conn.commit()
return db_ret[0][0]
except Exception as e:
log.e('[sqlite] _last_insert_id() failed: {}\n'.format(e.__str__()))

View File

@ -22,9 +22,13 @@ def get_free_space_bytes(folder):
total_bytes = _total_bytes.value
free_bytes = _free_bytes.value
else:
try:
st = os.statvfs(folder)
total_bytes = st.f_blocks * st.f_frsize
free_bytes = st.f_bavail * st.f_frsize
except:
total_bytes = 0
free_bytes = 0
return total_bytes, free_bytes