mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-20 00:24:18 -05:00
Merge pull request #6714 from matrix-org/babolivier/retention_select_event
Fix instantiation of message retention purge jobs
This commit is contained in:
commit
3b72bb780a
1
changelog.d/6714.bugfix
Normal file
1
changelog.d/6714.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a bug causing Synapse to not always purge quiet rooms with a low `max_lifetime` in their message retention policies when running the automated purge jobs.
|
@ -156,7 +156,7 @@ class PaginationHandler(object):
|
|||||||
|
|
||||||
stream_ordering = yield self.store.find_first_stream_ordering_after_ts(ts)
|
stream_ordering = yield self.store.find_first_stream_ordering_after_ts(ts)
|
||||||
|
|
||||||
r = yield self.store.get_room_event_after_stream_ordering(
|
r = yield self.store.get_room_event_before_stream_ordering(
|
||||||
room_id, stream_ordering,
|
room_id, stream_ordering,
|
||||||
)
|
)
|
||||||
if not r:
|
if not r:
|
||||||
|
@ -107,7 +107,7 @@ class PurgeHistoryRestServlet(RestServlet):
|
|||||||
|
|
||||||
stream_ordering = await self.store.find_first_stream_ordering_after_ts(ts)
|
stream_ordering = await self.store.find_first_stream_ordering_after_ts(ts)
|
||||||
|
|
||||||
r = await self.store.get_room_event_after_stream_ordering(
|
r = await self.store.get_room_event_before_stream_ordering(
|
||||||
room_id, stream_ordering
|
room_id, stream_ordering
|
||||||
)
|
)
|
||||||
if not r:
|
if not r:
|
||||||
|
@ -525,8 +525,8 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||||||
|
|
||||||
return rows, token
|
return rows, token
|
||||||
|
|
||||||
def get_room_event_after_stream_ordering(self, room_id, stream_ordering):
|
def get_room_event_before_stream_ordering(self, room_id, stream_ordering):
|
||||||
"""Gets details of the first event in a room at or after a stream ordering
|
"""Gets details of the first event in a room at or before a stream ordering
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
room_id (str):
|
room_id (str):
|
||||||
@ -541,15 +541,15 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||||||
sql = (
|
sql = (
|
||||||
"SELECT stream_ordering, topological_ordering, event_id"
|
"SELECT stream_ordering, topological_ordering, event_id"
|
||||||
" FROM events"
|
" FROM events"
|
||||||
" WHERE room_id = ? AND stream_ordering >= ?"
|
" WHERE room_id = ? AND stream_ordering <= ?"
|
||||||
" AND NOT outlier"
|
" AND NOT outlier"
|
||||||
" ORDER BY stream_ordering"
|
" ORDER BY stream_ordering DESC"
|
||||||
" LIMIT 1"
|
" LIMIT 1"
|
||||||
)
|
)
|
||||||
txn.execute(sql, (room_id, stream_ordering))
|
txn.execute(sql, (room_id, stream_ordering))
|
||||||
return txn.fetchone()
|
return txn.fetchone()
|
||||||
|
|
||||||
return self.db.runInteraction("get_room_event_after_stream_ordering", _f)
|
return self.db.runInteraction("get_room_event_before_stream_ordering", _f)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_room_events_max_id(self, room_id=None):
|
def get_room_events_max_id(self, room_id=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user