summaryrefslogtreecommitdiff
path: root/src/jwebmail/read_mails.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jwebmail/read_mails.py')
-rw-r--r--src/jwebmail/read_mails.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jwebmail/read_mails.py b/src/jwebmail/read_mails.py
index 05c6e10..cae04b1 100644
--- a/src/jwebmail/read_mails.py
+++ b/src/jwebmail/read_mails.py
@@ -89,10 +89,10 @@ class SqliteTimeoutSession:
self.timeout = timeout
- self.conn = sqlite3.connect(database, autocommit=False)
+ self.conn = sqlite3.connect(database)
cur = self.conn.cursor()
cur.execute(
- "CREATE TABLE IF NOT EXISTS session (user text PRIMARY KEY, password text, timeout real NOT NULL) STRICT"
+ "CREATE TABLE IF NOT EXISTS session (user text PRIMARY KEY, password text, timeout integer NOT NULL) STRICT"
)
cur.execute("CREATE INDEX IF NOT EXISTS timeout_idx ON session (timeout)")
@@ -101,14 +101,14 @@ class SqliteTimeoutSession:
with closing(self.conn.cursor()) as cur:
cur.execute(
- "REPLACE INTO session VALUES (?, ?, unixepoch(?, 'subsec'))",
+ "REPLACE INTO session VALUES (?, ?, unixepoch(?))",
[key, value, timeout],
)
self.conn.commit()
def get(self, key):
with closing(self.conn.cursor()) as cur:
- cur.execute("DELETE FROM session WHERE timeout < unixepoch('subsec')")
+ cur.execute("DELETE FROM session WHERE timeout < unixepoch()")
cur.execute("SELECT password FROM session WHERE user = ?", [key])
row = cur.fetchone()
@@ -118,7 +118,7 @@ class SqliteTimeoutSession:
else:
timeout = datetime.now() + timedelta(seconds=self.timeout)
cur.execute(
- "UPDATE session SET timeout = unixepoch(?, 'subsec') WHERE user = ?",
+ "UPDATE session SET timeout = unixepoch(?) WHERE user = ?",
[timeout, key],
)
self.conn.commit()