From a01cbb8600524d029c7196d4d320dfd680003a79 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Mon, 11 Jul 2022 16:43:16 +0200 Subject: [PATCH] Avoid unnecessary marshalling if sending to the local server --- federationapi/consumers/sendtodevice.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/federationapi/consumers/sendtodevice.go b/federationapi/consumers/sendtodevice.go index 84c9f620d..f99a895e0 100644 --- a/federationapi/consumers/sendtodevice.go +++ b/federationapi/consumers/sendtodevice.go @@ -95,6 +95,11 @@ func (t *OutputSendToDeviceConsumer) onMessage(ctx context.Context, msg *nats.Ms return true } + // The SyncAPI is already handling sendToDevice for the local server + if destServerName == t.ServerName { + return true + } + // Pack the EDU and marshal it edu := &gomatrixserverlib.EDU{ Type: gomatrixserverlib.MDirectToDevice,