Skip to content

Commit 47e8349

Browse files
committed
Update some more checks
1 parent a08a79e commit 47e8349

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mautrix/crypto/store/asyncpg/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async def has_group_session(
272272
async def add_outbound_group_session(self, session: OutboundGroupSession) -> None:
273273
pickle = session.pickle(self.pickle_key)
274274
max_age = session.max_age
275-
if self.db.scheme == "sqlite":
275+
if self.db.scheme == Scheme.SQLITE:
276276
max_age = max_age.total_seconds()
277277
await self.db.execute(
278278
"INSERT INTO crypto_megolm_outbound_session (room_id, session_id, session, shared, "
@@ -316,7 +316,7 @@ async def get_outbound_group_session(self, room_id: RoomID) -> OutboundGroupSess
316316
if row is None:
317317
return None
318318
max_age = row["max_age"]
319-
if self.db.scheme == "sqlite":
319+
if self.db.scheme == Scheme.SQLITE:
320320
max_age = timedelta(seconds=max_age)
321321
return OutboundGroupSession.from_pickle(
322322
row["session"],

mautrix/util/async_db/connection.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ import asyncpg
1212
from mautrix.util.logging import TraceLogger
1313

1414
from . import aiosqlite
15+
from .scheme import Scheme
1516

1617
class LoggingConnection:
17-
scheme: str
18+
scheme: Scheme
1819
wrapped: aiosqlite.TxnConnection | asyncpg.Connection
1920
log: TraceLogger
2021
def __init__(
21-
self, scheme: str, wrapped: aiosqlite.TxnConnection | asyncpg.Connection, log: TraceLogger
22+
self,
23+
scheme: Scheme,
24+
wrapped: aiosqlite.TxnConnection | asyncpg.Connection,
25+
log: TraceLogger,
2226
) -> None: ...
2327
async def transaction(self) -> AsyncContextManager[None]: ...
2428
async def execute(self, query: str, *args: Any, timeout: float | None = None) -> str: ...

0 commit comments

Comments
 (0)