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

Commit b5169ea

Browse files
committed
Do an early return when the two sets of auth events are the same.
1 parent 2a017da commit b5169ea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

synapse/handlers/federation_event.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import collections
1516
import itertools
1617
import logging
1718
from http import HTTPStatus
@@ -1536,6 +1537,14 @@ async def _check_event_auth(
15361537
calculated_auth_event_ids = self._event_auth_handler.compute_auth_events(
15371538
event, prev_state_ids, for_verification=True
15381539
)
1540+
1541+
# if those are the same, we're done here.
1542+
if collections.Counter(event.auth_event_ids()) == collections.Counter(
1543+
calculated_auth_event_ids
1544+
):
1545+
return context
1546+
1547+
# otherwise, re-run the auth checks based on what we calculated.
15391548
calculated_auth_events = await self._store.get_events_as_list(
15401549
calculated_auth_event_ids
15411550
)

0 commit comments

Comments
 (0)