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

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
babolivier committed Aug 2, 2019
1 parent dfb6fc5 commit 8ef235c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 0 additions & 1 deletion synapse/handlers/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from synapse.api.constants import EventTypes, Membership
from synapse.api.errors import SynapseError
from synapse.config._base import Config
from synapse.storage.state import StateFilter
from synapse.types import RoomStreamToken
from synapse.util.async_helpers import ReadWriteLock
Expand Down
18 changes: 11 additions & 7 deletions synapse/storage/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ def __init__(self, db_conn, hs):
self.config = hs.config

self.register_background_update_handler(
"users_set_deactivated_flag", self._background_insert_retention,
"insert_room_retention", self._background_insert_retention,
)

@defer.inlineCallbacks
def _background_insert_retention(self, progress, batch_size):
"""Retrieves a list of all rooms within a range and inserts an entry for each of
them into the room_retention table.
Expand All @@ -245,12 +246,15 @@ def _background_insert_retention(self, progress, batch_size):
def _background_insert_retention_txn(txn):
txn.execute(
"""
SELECT r.room_id, e.json as retention_content FROM rooms as r
LEFT OUTER JOIN current_state_events as s ON (
r.room_id = s.room_id
AND s.type = '%s'
SELECT rooms.room_id, events.json FROM rooms
LEFT OUTER JOIN current_state_events AS state ON (
rooms.room_id = state.room_id
AND state.type = '%s'
)
LEFT JOIN event_json as e ON (s.event_id = e.event_id);
LEFT JOIN event_json AS events ON (state.event_id = events.event_id)
WHERE rooms.room_id > ?
ORDER BY rooms.room_id ASC
LIMIT ?;
""" % EventTypes.Retention,
(last_room, batch_size)
)
Expand Down Expand Up @@ -286,7 +290,7 @@ def _background_insert_retention_txn(txn):

self._background_update_progress_txn(
txn, "insert_room_retention", {
"room_id": rows[-1]["insert_room_retention"],
"room_id": rows[-1]["room_id"],
}
)

Expand Down

0 comments on commit 8ef235c

Please sign in to comment.