Optimize DB access using transactions
This commit is contained in:
parent
07cf25b324
commit
d972594553
2 changed files with 3 additions and 4 deletions
|
@ -82,9 +82,6 @@ class ItemBase(object):
|
||||||
self.plexconn.commit()
|
self.plexconn.commit()
|
||||||
self.artconn.commit()
|
self.artconn.commit()
|
||||||
self.kodiconn.commit()
|
self.kodiconn.commit()
|
||||||
self.plexconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
|
|
||||||
self.artconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
|
|
||||||
self.kodiconn.execute('PRAGMA wal_checkpoint(TRUNCATE);')
|
|
||||||
|
|
||||||
def set_fanart(self, artworks, kodi_id, kodi_type):
|
def set_fanart(self, artworks, kodi_id, kodi_type):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -404,7 +404,9 @@ def kodi_sql(media_type=None):
|
||||||
db_path = v.DB_VIDEO_PATH
|
db_path = v.DB_VIDEO_PATH
|
||||||
conn = connect(db_path, timeout=5.0)
|
conn = connect(db_path, timeout=5.0)
|
||||||
conn.execute('PRAGMA journal_mode=WAL')
|
conn.execute('PRAGMA journal_mode=WAL')
|
||||||
conn.execute('PRAGMA wal_autocheckpoint=500;')
|
conn.execute('PRAGMA synchronous=NORMAL;')
|
||||||
|
# Use transactions
|
||||||
|
conn.execute('BEGIN;')
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue