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

Commit 00c8989

Browse files
committed
Do an early return when the two sets of auth events are the same.
1 parent 52e68da commit 00c8989

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
@@ -1539,6 +1540,14 @@ async def _check_event_auth(
15391540
calculated_auth_event_ids = self._event_auth_handler.compute_auth_events(
15401541
event, prev_state_ids, for_verification=True
15411542
)
1543+
1544+
# if those are the same, we're done here.
1545+
if collections.Counter(event.auth_event_ids()) == collections.Counter(
1546+
calculated_auth_event_ids
1547+
):
1548+
return context
1549+
1550+
# otherwise, re-run the auth checks based on what we calculated.
15421551
calculated_auth_events = await self._store.get_events_as_list(
15431552
calculated_auth_event_ids
15441553
)

0 commit comments

Comments
 (0)