From 8d8e10b7b31cfc1e4978a9136ddd45da73fc6523 Mon Sep 17 00:00:00 2001 From: Alain St-Denis Date: Sat, 25 Feb 2023 11:53:44 -0500 Subject: [PATCH] Optimize handle_send by ensuring a payload is sent only once per endpoint. --- federation/outbound.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federation/outbound.py b/federation/outbound.py index ad695b8..2ee6938 100644 --- a/federation/outbound.py +++ b/federation/outbound.py @@ -167,7 +167,7 @@ def handle_send( logger.debug('handle_send - length of recipients: %s', len(recipients)) # Flatten to unique recipients # TODO supply a callable that empties "fid" in the case that public=True - unique_recipients = list(unique_everseen(recipients)) + unique_recipients = list(unique_everseen(recipients, key=lambda val: val['endpoints'])) logger.debug('handle_send - length of unique_recipients: %s', len(unique_recipients)) logger.debug('handle_send / unique_recipients - %s', unique_recipients)