@@ -114,6 +114,10 @@ def __init__(self, room_id: str):
114
114
115
115
116
116
class EventFederationWorkerStore (SignatureWorkerStore , EventsWorkerStore , SQLBaseStore ):
117
+ # TODO: this attribute comes from EventPushActionWorkerStore. Should we inherit from
118
+ # that store so that mypy can deduce this for itself?
119
+ stream_ordering_month_ago : Optional [int ]
120
+
117
121
def __init__ (
118
122
self ,
119
123
database : DatabasePool ,
@@ -1182,8 +1186,8 @@ async def have_room_forward_extremities_changed_since(
1182
1186
Throws a StoreError if we have since purged the index for
1183
1187
stream_orderings from that point.
1184
1188
"""
1185
-
1186
- if stream_ordering <= self .stream_ordering_month_ago : # type: ignore[attr-defined]
1189
+ assert self . stream_ordering_month_ago is not None
1190
+ if stream_ordering <= self .stream_ordering_month_ago :
1187
1191
raise StoreError (400 , f"stream_ordering too old { stream_ordering } " )
1188
1192
1189
1193
sql = """
@@ -1231,7 +1235,8 @@ async def get_forward_extremities_for_room_at_stream_ordering(
1231
1235
1232
1236
# provided the last_change is recent enough, we now clamp the requested
1233
1237
# stream_ordering to it.
1234
- if last_change > self .stream_ordering_month_ago : # type: ignore[attr-defined]
1238
+ assert self .stream_ordering_month_ago is not None
1239
+ if last_change > self .stream_ordering_month_ago :
1235
1240
stream_ordering = min (last_change , stream_ordering )
1236
1241
1237
1242
return await self ._get_forward_extremeties_for_room (room_id , stream_ordering )
@@ -1246,8 +1251,8 @@ async def _get_forward_extremeties_for_room(
1246
1251
Throws a StoreError if we have since purged the index for
1247
1252
stream_orderings from that point.
1248
1253
"""
1249
-
1250
- if stream_ordering <= self .stream_ordering_month_ago : # type: ignore[attr-defined]
1254
+ assert self . stream_ordering_month_ago is not None
1255
+ if stream_ordering <= self .stream_ordering_month_ago :
1251
1256
raise StoreError (400 , "stream_ordering too old %s" % (stream_ordering ,))
1252
1257
1253
1258
sql = """
@@ -1707,9 +1712,7 @@ def _delete_old_forward_extrem_cache_txn(txn: LoggingTransaction) -> None:
1707
1712
DELETE FROM stream_ordering_to_exterm
1708
1713
WHERE stream_ordering < ?
1709
1714
"""
1710
- txn .execute (
1711
- sql , (self .stream_ordering_month_ago ,) # type: ignore[attr-defined]
1712
- )
1715
+ txn .execute (sql , (self .stream_ordering_month_ago ,))
1713
1716
1714
1717
await self .db_pool .runInteraction (
1715
1718
"_delete_old_forward_extrem_cache" ,
0 commit comments