Commit cc82e613 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos/collect: Set pragma to wal

  To allow more concurrent access to the sqlite
parent 84ff7a8c
...@@ -38,6 +38,7 @@ class Database: ...@@ -38,6 +38,7 @@ class Database:
database_name = "collector.db" database_name = "collector.db"
preserve_table_list = ["heating"] preserve_table_list = ["heating"]
SET_PRAGMA_MODE = "pragma journal_mode=wal"
CREATE_USER_TABLE = "create table if not exists user " \ CREATE_USER_TABLE = "create table if not exists user " \
"(partition text, pid real, process text, " \ "(partition text, pid real, process text, " \
" cpu_percent real, cpu_time real, " \ " cpu_percent real, cpu_time real, " \
...@@ -152,6 +153,7 @@ class Database: ...@@ -152,6 +153,7 @@ class Database:
def _bootstrap(self): def _bootstrap(self):
assert self.CREATE_USER_TABLE is not None assert self.CREATE_USER_TABLE is not None
self.connect() self.connect()
self._execute(self.SET_PRAGMA_MODE)
self._execute(self.CREATE_USER_TABLE) self._execute(self.CREATE_USER_TABLE)
self._execute(self.CREATE_USER_PARTITION_DATE_TIME_INDEX) self._execute(self.CREATE_USER_PARTITION_DATE_TIME_INDEX)
self._execute(self.CREATE_FOLDER_TABLE) self._execute(self.CREATE_FOLDER_TABLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment