Fix session interface method indentation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d6519bde66
commit
b90e632ec7
|
|
@ -83,18 +83,6 @@ class SQLiteSessionInterface(SessionInterface):
|
||||||
def rotate_session(self, session) -> None:
|
def rotate_session(self, session) -> None:
|
||||||
session.session_id = self._new_session_id()
|
session.session_id = self._new_session_id()
|
||||||
|
|
||||||
|
|
||||||
def cleanup_expired_sessions() -> int:
|
|
||||||
"""Remove expired sessions from the database."""
|
|
||||||
conn = connect_db()
|
|
||||||
try:
|
|
||||||
now = datetime.utcnow().isoformat()
|
|
||||||
cursor = conn.execute("DELETE FROM web_sessions WHERE expires_at < ?", [now])
|
|
||||||
conn.commit()
|
|
||||||
return cursor.rowcount or 0
|
|
||||||
finally:
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _new_session_id() -> str:
|
def _new_session_id() -> str:
|
||||||
return uuid.uuid4().hex
|
return uuid.uuid4().hex
|
||||||
|
|
@ -107,3 +95,15 @@ def cleanup_expired_sessions() -> int:
|
||||||
return datetime.fromisoformat(value)
|
return datetime.fromisoformat(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup_expired_sessions() -> int:
|
||||||
|
"""Remove expired sessions from the database."""
|
||||||
|
conn = connect_db()
|
||||||
|
try:
|
||||||
|
now = datetime.utcnow().isoformat()
|
||||||
|
cursor = conn.execute("DELETE FROM web_sessions WHERE expires_at < ?", [now])
|
||||||
|
conn.commit()
|
||||||
|
return cursor.rowcount or 0
|
||||||
|
finally:
|
||||||
|
conn.close()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue