mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-13 15:19:29 +01:00
Properly pass the cache size when initializing a db connection
This commit is contained in:
@@ -33,6 +33,9 @@ db_lock = threading.Lock()
|
||||
def dbFilename(filename="headphones.db"):
|
||||
|
||||
return os.path.join(headphones.DATA_DIR, filename)
|
||||
|
||||
def getCacheSize():
|
||||
return int(headphones.CACHE_SIZEMB)
|
||||
|
||||
class DBConnection:
|
||||
|
||||
@@ -45,7 +48,7 @@ class DBConnection:
|
||||
#journal disabled since we never do rollbacks
|
||||
self.connection.execute("PRAGMA journal_mode = OFF")
|
||||
#64mb of cache memory,probably need to make it user configurable
|
||||
self.connection.execute("PRAGMA cache_size=-%s" % (headphones.CACHE_SIZEMB*1024))
|
||||
self.connection.execute("PRAGMA cache_size=-%s" % (getCacheSize()*1024))
|
||||
self.connection.row_factory = sqlite3.Row
|
||||
|
||||
def action(self, query, args=None):
|
||||
|
||||
Reference in New Issue
Block a user