Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6714 from matrix-org/babolivier/retention_select_…
Browse files Browse the repository at this point in the history
…event

* commit '3b72bb780':
  bump version to v1.9.0.dev1
  Precise changelog
  Fixup diff
  Remove get_room_event_after_stream_ordering entirely
  Lint
  Rename changelog
  Changelog
  Correctly order when selecting before stream ordering
  Fix typo
  Fix instantiation of message retention purge jobs
  • Loading branch information
anoadragon453 committed Mar 23, 2020
2 parents f7fb31d + 3b72bb7 commit f2df969
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.d/6714.bugfix
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
except ImportError:
pass

__version__ = "1.8.0"
__version__ = "1.9.0.dev1"

if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
# We import here so that we don't have to install a bunch of deps when
Expand Down
2 changes: 1 addition & 1 deletion synapse/handlers/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def purge_history_for_rooms_in_range(self, min_ms, max_ms):

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,
)
if not r:
Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def on_POST(self, request, room_id, event_id):

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
)
if not r:
Expand Down
10 changes: 5 additions & 5 deletions synapse/storage/data_stores/main/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,8 @@ def get_recent_event_ids_for_room(self, room_id, limit, end_token):

return rows, token

def get_room_event_after_stream_ordering(self, room_id, stream_ordering):
"""Gets details of the first event in a room at or after a 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 before a stream ordering
Args:
room_id (str):
Expand All @@ -541,15 +541,15 @@ def _f(txn):
sql = (
"SELECT stream_ordering, topological_ordering, event_id"
" FROM events"
" WHERE room_id = ? AND stream_ordering >= ?"
" WHERE room_id = ? AND stream_ordering <= ?"
" AND NOT outlier"
" ORDER BY stream_ordering"
" ORDER BY stream_ordering DESC"
" LIMIT 1"
)
txn.execute(sql, (room_id, stream_ordering))
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
def get_room_events_max_id(self, room_id=None):
Expand Down

0 comments on commit f2df969

Please sign in to comment.