Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
commit
1a0c407e6b
|
|
@ -156,7 +156,7 @@ workflows:
|
|||
- dockerhubuploadrelease:
|
||||
filters:
|
||||
tags:
|
||||
only: /^v[0-9].[0-9]+.[0-9]+(.[0-9]+)?/
|
||||
only: /v[0-9].[0-9]+.[0-9]+.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- dockerhubuploadlatest:
|
||||
|
|
|
|||
84
CHANGES.md
84
CHANGES.md
|
|
@ -1,11 +1,91 @@
|
|||
Synapse 0.33.6 (2018-10-04)
|
||||
===========================
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
||||
- Pin to prometheus_client<0.4 to avoid renaming all of our metrics ([\#4002](https://github.com/matrix-org/synapse/issues/4002))
|
||||
|
||||
|
||||
Synapse 0.33.6rc1 (2018-10-03)
|
||||
==============================
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Adding the ability to change MAX_UPLOAD_SIZE for the docker container variables. ([\#3883](https://github.com/matrix-org/synapse/issues/3883))
|
||||
- Report "python_version" in the phone home stats ([\#3894](https://github.com/matrix-org/synapse/issues/3894))
|
||||
- Always LL ourselves if we're in a room ([\#3916](https://github.com/matrix-org/synapse/issues/3916))
|
||||
- Include eventid in log lines when processing incoming federation transactions ([\#3959](https://github.com/matrix-org/synapse/issues/3959))
|
||||
- Remove spurious check which made 'localhost' servers not work ([\#3964](https://github.com/matrix-org/synapse/issues/3964))
|
||||
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Fix problem when playing media from Chrome using direct URL (thanks @remjey!) ([\#3578](https://github.com/matrix-org/synapse/issues/3578))
|
||||
- support registering regular users non-interactively with register_new_matrix_user script ([\#3836](https://github.com/matrix-org/synapse/issues/3836))
|
||||
- Fix broken invite email links for self hosted riots ([\#3868](https://github.com/matrix-org/synapse/issues/3868))
|
||||
- Don't ratelimit autojoins ([\#3879](https://github.com/matrix-org/synapse/issues/3879))
|
||||
- Fix 500 error when deleting unknown room alias ([\#3889](https://github.com/matrix-org/synapse/issues/3889))
|
||||
- Fix some b'abcd' noise in logs and metrics ([\#3892](https://github.com/matrix-org/synapse/issues/3892), [\#3895](https://github.com/matrix-org/synapse/issues/3895))
|
||||
- When we join a room, always try the server we used for the alias lookup first, to avoid unresponsive and out-of-date servers. ([\#3899](https://github.com/matrix-org/synapse/issues/3899))
|
||||
- Fix incorrect server-name indication for outgoing federation requests ([\#3907](https://github.com/matrix-org/synapse/issues/3907))
|
||||
- Fix adding client IPs to the database failing on Python 3. ([\#3908](https://github.com/matrix-org/synapse/issues/3908))
|
||||
- Fix bug where things occaisonally were not being timed out correctly. ([\#3910](https://github.com/matrix-org/synapse/issues/3910))
|
||||
- Fix bug where outbound federation would stop talking to some servers when using workers ([\#3914](https://github.com/matrix-org/synapse/issues/3914))
|
||||
- Fix some instances of ExpiringCache not expiring cache items ([\#3932](https://github.com/matrix-org/synapse/issues/3932), [\#3980](https://github.com/matrix-org/synapse/issues/3980))
|
||||
- Fix out-of-bounds error when LLing yourself ([\#3936](https://github.com/matrix-org/synapse/issues/3936))
|
||||
- Sending server notices regarding user consent now works on Python 3. ([\#3938](https://github.com/matrix-org/synapse/issues/3938))
|
||||
- Fix exceptions from metrics handler ([\#3956](https://github.com/matrix-org/synapse/issues/3956))
|
||||
- Fix error message for events with m.room.create missing from auth_events ([\#3960](https://github.com/matrix-org/synapse/issues/3960))
|
||||
- Fix errors due to concurrent monthly_active_user upserts ([\#3961](https://github.com/matrix-org/synapse/issues/3961))
|
||||
- Fix exceptions when processing incoming events over federation ([\#3968](https://github.com/matrix-org/synapse/issues/3968))
|
||||
- Replaced all occurences of e.message with str(e). Contributed by Schnuffle ([\#3970](https://github.com/matrix-org/synapse/issues/3970))
|
||||
- Fix lazy loaded sync in the presence of rejected state events ([\#3986](https://github.com/matrix-org/synapse/issues/3986))
|
||||
- Fix error when logging incomplete HTTP requests ([\#3990](https://github.com/matrix-org/synapse/issues/3990))
|
||||
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
||||
- Unit tests can now be run under PostgreSQL in Docker using ``test_postgresql.sh``. ([\#3699](https://github.com/matrix-org/synapse/issues/3699))
|
||||
- Speed up calculation of typing updates for replication ([\#3794](https://github.com/matrix-org/synapse/issues/3794))
|
||||
- Remove documentation regarding installation on Cygwin, the use of WSL is recommended instead. ([\#3873](https://github.com/matrix-org/synapse/issues/3873))
|
||||
- Fix typo in README, synaspse -> synapse ([\#3897](https://github.com/matrix-org/synapse/issues/3897))
|
||||
- Increase the timeout when filling missing events in federation requests ([\#3903](https://github.com/matrix-org/synapse/issues/3903))
|
||||
- Improve the logging when handling a federation transaction ([\#3904](https://github.com/matrix-org/synapse/issues/3904), [\#3966](https://github.com/matrix-org/synapse/issues/3966))
|
||||
- Improve logging of outbound federation requests ([\#3906](https://github.com/matrix-org/synapse/issues/3906), [\#3909](https://github.com/matrix-org/synapse/issues/3909))
|
||||
- Fix the docker image building on python 3 ([\#3911](https://github.com/matrix-org/synapse/issues/3911))
|
||||
- Add a regression test for logging failed HTTP requests on Python 3. ([\#3912](https://github.com/matrix-org/synapse/issues/3912))
|
||||
- Comments and interface cleanup for on_receive_pdu ([\#3924](https://github.com/matrix-org/synapse/issues/3924))
|
||||
- Fix spurious exceptions when remote http client closes conncetion ([\#3925](https://github.com/matrix-org/synapse/issues/3925))
|
||||
- Log exceptions thrown by background tasks ([\#3927](https://github.com/matrix-org/synapse/issues/3927))
|
||||
- Add a cache to get_destination_retry_timings ([\#3933](https://github.com/matrix-org/synapse/issues/3933), [\#3991](https://github.com/matrix-org/synapse/issues/3991))
|
||||
- Automate pushes to docker hub ([\#3946](https://github.com/matrix-org/synapse/issues/3946))
|
||||
- Require attrs 16.0.0 or later ([\#3947](https://github.com/matrix-org/synapse/issues/3947))
|
||||
- Fix incompatibility with python3 on alpine ([\#3948](https://github.com/matrix-org/synapse/issues/3948))
|
||||
- Run the test suite on the oldest supported versions of our dependencies in CI. ([\#3952](https://github.com/matrix-org/synapse/issues/3952))
|
||||
- CircleCI now only runs merged jobs on PRs, and commit jobs on develop, master, and release branches. ([\#3957](https://github.com/matrix-org/synapse/issues/3957))
|
||||
- Fix docstrings and add tests for state store methods ([\#3958](https://github.com/matrix-org/synapse/issues/3958))
|
||||
- fix docstring for FederationClient.get_state_for_room ([\#3963](https://github.com/matrix-org/synapse/issues/3963))
|
||||
- Run notify_app_services as a bg process ([\#3965](https://github.com/matrix-org/synapse/issues/3965))
|
||||
- Clarifications in FederationHandler ([\#3967](https://github.com/matrix-org/synapse/issues/3967))
|
||||
- Further reduce the docker image size ([\#3972](https://github.com/matrix-org/synapse/issues/3972))
|
||||
- Build py3 docker images for docker hub too ([\#3976](https://github.com/matrix-org/synapse/issues/3976))
|
||||
- Updated the installation instructions to point to the matrix-synapse package on PyPI. ([\#3985](https://github.com/matrix-org/synapse/issues/3985))
|
||||
- Disable USE_FROZEN_DICTS for unittests by default. ([\#3987](https://github.com/matrix-org/synapse/issues/3987))
|
||||
- Remove unused Jenkins and development related files from the repo. ([\#3988](https://github.com/matrix-org/synapse/issues/3988))
|
||||
- Improve stacktraces in certain exceptions in the logs ([\#3989](https://github.com/matrix-org/synapse/issues/3989))
|
||||
|
||||
|
||||
Synapse 0.33.5.1 (2018-09-25)
|
||||
=============================
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
||||
- Fix incompatibility with older Twisted version in tests. Thanks
|
||||
@OlegGirko! ([\#3940](https://github.com/matrix-org/synapse/issues/3940))
|
||||
- Fix incompatibility with older Twisted version in tests. Thanks @OlegGirko! ([\#3940](https://github.com/matrix-org/synapse/issues/3940))
|
||||
|
||||
|
||||
Synapse 0.33.5 (2018-09-24)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Fix problem when playing media from Chrome using direct URL (thanks @remjey!)
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
Unit tests can now be run under PostgreSQL in Docker using
|
||||
``test_postgresql.sh``.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Speed up calculation of typing updates for replication
|
||||
|
|
@ -1 +0,0 @@
|
|||
support registering regular users non-interactively with register_new_matrix_user script
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix broken invite email links for self hosted riots
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
Remove documentation regarding installation on Cygwin, the use of WSL is
|
||||
recommended instead.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Don't ratelimit autojoins
|
||||
|
|
@ -1 +0,0 @@
|
|||
Adding the ability to change MAX_UPLOAD_SIZE for the docker container variables.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix 500 error when deleting unknown room alias
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix some b'abcd' noise in logs and metrics
|
||||
|
|
@ -1 +0,0 @@
|
|||
Report "python_version" in the phone home stats
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix some b'abcd' noise in logs and metrics
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix typo in README, synaspse -> synapse
|
||||
|
|
@ -1 +0,0 @@
|
|||
When we join a room, always try the server we used for the alias lookup first, to avoid unresponsive and out-of-date servers.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Increase the timeout when filling missing events in federation requests
|
||||
|
|
@ -1 +0,0 @@
|
|||
Improve the logging when handling a federation transaction
|
||||
|
|
@ -1 +0,0 @@
|
|||
Improve logging of outbound federation requests
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix incorrect server-name indication for outgoing federation requests
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix adding client IPs to the database failing on Python 3.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Improve logging of outbound federation requests
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix bug where things occaisonally were not being timed out correctly.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix the docker image building on python 3
|
||||
|
|
@ -1 +0,0 @@
|
|||
Add a regression test for logging failed HTTP requests on Python 3.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix bug where outbound federation would stop talking to some servers when using workers
|
||||
|
|
@ -1 +0,0 @@
|
|||
Always LL ourselves if we're in a room
|
||||
|
|
@ -1 +0,0 @@
|
|||
Comments and interface cleanup for on_receive_pdu
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix spurious exceptions when remote http client closes conncetion
|
||||
|
|
@ -1 +0,0 @@
|
|||
Log exceptions thrown by background tasks
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix some instances of ExpiringCache not expiring cache items
|
||||
|
|
@ -1 +0,0 @@
|
|||
Add a cache to get_destination_retry_timings
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix out-of-bounds error when LLing yourself
|
||||
|
|
@ -1 +0,0 @@
|
|||
Sending server notices regarding user consent now works on Python 3.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Automate pushes to docker hub
|
||||
|
|
@ -1 +0,0 @@
|
|||
Require attrs 16.0.0 or later
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix incompatibility with python3 on alpine
|
||||
|
|
@ -1 +0,0 @@
|
|||
Run the test suite on the oldest supported versions of our dependencies in CI.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix exceptions from metrics handler
|
||||
|
|
@ -1 +0,0 @@
|
|||
CircleCI now only runs merged jobs on PRs, and commit jobs on develop, master, and release branches.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix docstrings and add tests for state store methods
|
||||
|
|
@ -1 +0,0 @@
|
|||
Include eventid in log lines when processing incoming federation transactions
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix error message for events with m.room.create missing from auth_events
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix errors due to concurrent monthly_active_user upserts
|
||||
|
|
@ -1 +0,0 @@
|
|||
fix docstring for FederationClient.get_state_for_room
|
||||
|
|
@ -1 +0,0 @@
|
|||
Remove spurious check which made 'localhost' servers not work
|
||||
|
|
@ -1 +0,0 @@
|
|||
Run notify_app_services as a bg process
|
||||
|
|
@ -1 +0,0 @@
|
|||
Improve the logging when handling a federation transaction
|
||||
|
|
@ -1 +0,0 @@
|
|||
Clarifications in FederationHandler
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix exceptions when processing incoming events over federation
|
||||
|
|
@ -1 +0,0 @@
|
|||
Replaced all occurences of e.message with str(e). Contributed by Schnuffle
|
||||
|
|
@ -1 +0,0 @@
|
|||
Further reduce the docker image size
|
||||
|
|
@ -1 +0,0 @@
|
|||
Build py3 docker images for docker hub too
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix some instances of ExpiringCache not expiring cache items
|
||||
|
|
@ -1 +0,0 @@
|
|||
Updated the installation instructions to point to the matrix-synapse package on PyPI.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix lazy loaded sync in the presence of rejected state events
|
||||
|
|
@ -1 +0,0 @@
|
|||
Disable USE_FROZEN_DICTS for unittests by default.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Remove unused Jenkins and development related files from the repo.
|
||||
|
|
@ -1 +0,0 @@
|
|||
Improve stacktraces in certain exceptions in the logs
|
||||
|
|
@ -1 +0,0 @@
|
|||
Fix error when logging incomplete HTTP requests
|
||||
|
|
@ -1 +0,0 @@
|
|||
Add a cache to get_destination_retry_timings
|
||||
|
|
@ -0,0 +1 @@
|
|||
Fix bug in event persistence logic which caused 'NoneType is not iterable'
|
||||
|
|
@ -0,0 +1 @@
|
|||
Fix exception in background metrics collection
|
||||
|
|
@ -0,0 +1 @@
|
|||
Fix exception handling in fetching remote profiles
|
||||
|
|
@ -0,0 +1 @@
|
|||
Fix handling of rejected threepid invites
|
||||
|
|
@ -27,4 +27,4 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
__version__ = "0.33.5.1"
|
||||
__version__ = "0.33.6"
|
||||
|
|
|
|||
|
|
@ -155,10 +155,7 @@ def check(event, auth_events, do_sig_check=True, do_size_check=True):
|
|||
|
||||
if user_level < invite_level:
|
||||
raise AuthError(
|
||||
403, (
|
||||
"You cannot issue a third party invite for %s." %
|
||||
(event.content.display_name,)
|
||||
)
|
||||
403, "You don't have permission to invite users",
|
||||
)
|
||||
else:
|
||||
logger.debug("Allowing! %s", event)
|
||||
|
|
@ -305,7 +302,7 @@ def _is_membership_change_allowed(event, auth_events):
|
|||
|
||||
if user_level < invite_level:
|
||||
raise AuthError(
|
||||
403, "You cannot invite user %s." % target_user_id
|
||||
403, "You don't have permission to invite users",
|
||||
)
|
||||
elif Membership.JOIN == membership:
|
||||
# Joins are valid iff caller == target and they were:
|
||||
|
|
|
|||
|
|
@ -142,10 +142,8 @@ class BaseProfileHandler(BaseHandler):
|
|||
if e.code != 404:
|
||||
logger.exception("Failed to get displayname")
|
||||
raise
|
||||
except Exception:
|
||||
logger.exception("Failed to get displayname")
|
||||
else:
|
||||
defer.returnValue(result["displayname"])
|
||||
|
||||
defer.returnValue(result["displayname"])
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def set_displayname(self, target_user, requester, new_displayname, by_admin=False):
|
||||
|
|
@ -199,8 +197,6 @@ class BaseProfileHandler(BaseHandler):
|
|||
if e.code != 404:
|
||||
logger.exception("Failed to get avatar_url")
|
||||
raise
|
||||
except Exception:
|
||||
logger.exception("Failed to get avatar_url")
|
||||
|
||||
defer.returnValue(result["avatar_url"])
|
||||
|
||||
|
|
|
|||
|
|
@ -101,9 +101,13 @@ class _Collector(object):
|
|||
labels=["name"],
|
||||
)
|
||||
|
||||
# We copy the dict so that it doesn't change from underneath us
|
||||
# We copy the dict so that it doesn't change from underneath us.
|
||||
# We also copy the process lists as that can also change
|
||||
with _bg_metrics_lock:
|
||||
_background_processes_copy = dict(_background_processes)
|
||||
_background_processes_copy = {
|
||||
k: list(v)
|
||||
for k, v in six.iteritems(_background_processes)
|
||||
}
|
||||
|
||||
for desc, processes in six.iteritems(_background_processes_copy):
|
||||
background_process_in_flight_count.add_metric(
|
||||
|
|
|
|||
|
|
@ -58,7 +58,10 @@ REQUIREMENTS = {
|
|||
"msgpack-python>=0.3.0": ["msgpack"],
|
||||
"phonenumbers>=8.2.0": ["phonenumbers"],
|
||||
"six>=1.10": ["six"],
|
||||
"prometheus_client>=0.0.18": ["prometheus_client"],
|
||||
|
||||
# prometheus_client 0.4.0 changed the format of counter metrics
|
||||
# (cf https://github.com/matrix-org/synapse/issues/4001)
|
||||
"prometheus_client>=0.0.18,<0.4.0": ["prometheus_client"],
|
||||
|
||||
# we use attr.s(slots), which arrived in 16.0.0
|
||||
"attrs>=16.0.0": ["attr>=16.0.0"],
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ from synapse.storage.background_updates import BackgroundUpdateStore
|
|||
from synapse.storage.event_federation import EventFederationStore
|
||||
from synapse.storage.events_worker import EventsWorkerStore
|
||||
from synapse.types import RoomStreamToken, get_domain_from_id
|
||||
from synapse.util import batch_iter
|
||||
from synapse.util.async_helpers import ObservableDeferred
|
||||
from synapse.util.caches.descriptors import cached, cachedInlineCallbacks
|
||||
from synapse.util.frozenutils import frozendict_json_encoder
|
||||
|
|
@ -386,12 +387,10 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore
|
|||
)
|
||||
|
||||
for room_id, ev_ctx_rm in iteritems(events_by_room):
|
||||
# Work out new extremities by recursively adding and removing
|
||||
# the new events.
|
||||
latest_event_ids = yield self.get_latest_event_ids_in_room(
|
||||
room_id
|
||||
)
|
||||
new_latest_event_ids = yield self._calculate_new_extremeties(
|
||||
new_latest_event_ids = yield self._calculate_new_extremities(
|
||||
room_id, ev_ctx_rm, latest_event_ids
|
||||
)
|
||||
|
||||
|
|
@ -400,6 +399,12 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore
|
|||
# No change in extremities, so no change in state
|
||||
continue
|
||||
|
||||
# there should always be at least one forward extremity.
|
||||
# (except during the initial persistence of the send_join
|
||||
# results, in which case there will be no existing
|
||||
# extremities, so we'll `continue` above and skip this bit.)
|
||||
assert new_latest_event_ids, "No forward extremities left!"
|
||||
|
||||
new_forward_extremeties[room_id] = new_latest_event_ids
|
||||
|
||||
len_1 = (
|
||||
|
|
@ -517,44 +522,79 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore
|
|||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _calculate_new_extremeties(self, room_id, event_contexts, latest_event_ids):
|
||||
"""Calculates the new forward extremeties for a room given events to
|
||||
def _calculate_new_extremities(self, room_id, event_contexts, latest_event_ids):
|
||||
"""Calculates the new forward extremities for a room given events to
|
||||
persist.
|
||||
|
||||
Assumes that we are only persisting events for one room at a time.
|
||||
"""
|
||||
new_latest_event_ids = set(latest_event_ids)
|
||||
# First, add all the new events to the list
|
||||
new_latest_event_ids.update(
|
||||
event.event_id for event, ctx in event_contexts
|
||||
|
||||
# we're only interested in new events which aren't outliers and which aren't
|
||||
# being rejected.
|
||||
new_events = [
|
||||
event for event, ctx in event_contexts
|
||||
if not event.internal_metadata.is_outlier() and not ctx.rejected
|
||||
]
|
||||
|
||||
# start with the existing forward extremities
|
||||
result = set(latest_event_ids)
|
||||
|
||||
# add all the new events to the list
|
||||
result.update(
|
||||
event.event_id for event in new_events
|
||||
)
|
||||
# Now remove all events that are referenced by the to-be-added events
|
||||
new_latest_event_ids.difference_update(
|
||||
|
||||
# Now remove all events which are prev_events of any of the new events
|
||||
result.difference_update(
|
||||
e_id
|
||||
for event, ctx in event_contexts
|
||||
for event in new_events
|
||||
for e_id, _ in event.prev_events
|
||||
if not event.internal_metadata.is_outlier() and not ctx.rejected
|
||||
)
|
||||
|
||||
# And finally remove any events that are referenced by previously added
|
||||
# events.
|
||||
rows = yield self._simple_select_many_batch(
|
||||
table="event_edges",
|
||||
column="prev_event_id",
|
||||
iterable=list(new_latest_event_ids),
|
||||
retcols=["prev_event_id"],
|
||||
keyvalues={
|
||||
"is_state": False,
|
||||
},
|
||||
desc="_calculate_new_extremeties",
|
||||
)
|
||||
# Finally, remove any events which are prev_events of any existing events.
|
||||
existing_prevs = yield self._get_events_which_are_prevs(result)
|
||||
result.difference_update(existing_prevs)
|
||||
|
||||
new_latest_event_ids.difference_update(
|
||||
row["prev_event_id"] for row in rows
|
||||
)
|
||||
defer.returnValue(result)
|
||||
|
||||
defer.returnValue(new_latest_event_ids)
|
||||
@defer.inlineCallbacks
|
||||
def _get_events_which_are_prevs(self, event_ids):
|
||||
"""Filter the supplied list of event_ids to get those which are prev_events of
|
||||
existing (non-outlier/rejected) events.
|
||||
|
||||
Args:
|
||||
event_ids (Iterable[str]): event ids to filter
|
||||
|
||||
Returns:
|
||||
Deferred[List[str]]: filtered event ids
|
||||
"""
|
||||
results = []
|
||||
|
||||
def _get_events(txn, batch):
|
||||
sql = """
|
||||
SELECT prev_event_id
|
||||
FROM event_edges
|
||||
INNER JOIN events USING (event_id)
|
||||
LEFT JOIN rejections USING (event_id)
|
||||
WHERE
|
||||
prev_event_id IN (%s)
|
||||
AND NOT events.outlier
|
||||
AND rejections.event_id IS NULL
|
||||
""" % (
|
||||
",".join("?" for _ in batch),
|
||||
)
|
||||
|
||||
txn.execute(sql, batch)
|
||||
results.extend(r[0] for r in txn)
|
||||
|
||||
for chunk in batch_iter(event_ids, 100):
|
||||
yield self.runInteraction(
|
||||
"_get_events_which_are_prevs",
|
||||
_get_events,
|
||||
chunk,
|
||||
)
|
||||
|
||||
defer.returnValue(results)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _get_new_state_after_events(self, room_id, events_context, old_latest_event_ids,
|
||||
|
|
@ -586,10 +626,6 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore
|
|||
the new current state is only returned if we've already calculated
|
||||
it.
|
||||
"""
|
||||
|
||||
if not new_latest_event_ids:
|
||||
return
|
||||
|
||||
# map from state_group to ((type, key) -> event_id) state map
|
||||
state_groups_map = {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue