Fix replication. And notify

This commit is contained in:
Erik Johnston 2017-07-20 17:13:18 +01:00
parent 139fe30f47
commit 2cc998fed8
5 changed files with 119 additions and 4 deletions

View file

@ -853,6 +853,8 @@ class GroupServerStore(SQLBaseStore):
},
)
return next_id
with self._group_updates_id_gen.get_next() as next_id:
yield self.runInteraction(
"register_user_group_membership",
@ -993,5 +995,26 @@ class GroupServerStore(SQLBaseStore):
"get_groups_changes_for_user", _get_groups_changes_for_user_txn,
)
def get_all_groups_changes(self, from_token, to_token, limit):
from_token = int(from_token)
has_changed = self._group_updates_stream_cache.has_any_entity_changed(
from_token,
)
if not has_changed:
return []
def _get_all_groups_changes_txn(txn):
sql = """
SELECT stream_id, group_id, user_id, type, content
FROM local_group_updates
WHERE ? < stream_id AND stream_id <= ?
LIMIT ?
"""
txn.execute(sql, (from_token, to_token, limit,))
return txn.fetchall()
return self.runInteraction(
"get_all_groups_changes", _get_all_groups_changes_txn,
)
def get_group_stream_token(self):
return self._group_updates_id_gen.get_current_token()