From 8cb16d6482dc592ba0c3d7252f17ef7c94e120a7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 5 Aug 2020 13:33:08 +0100 Subject: [PATCH] PerformServersAlive in PerformBroadcastEDU --- federationsender/internal/perform.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index d9a4b963e..9dcd97f6d 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -319,6 +319,11 @@ func (r *FederationSenderInternalAPI) PerformBroadcastEDU( if err != nil { return fmt.Errorf("r.db.GetAllJoinedHosts: %w", err) } + if len(destinations) == 0 { + return nil + } + + logrus.WithContext(ctx).Infof("Sending wake-up EDU to %d destination(s)", len(destinations)) edu := &gomatrixserverlib.EDU{ Type: "org.matrix.dendrite.wakeup", @@ -328,5 +333,13 @@ func (r *FederationSenderInternalAPI) PerformBroadcastEDU( return fmt.Errorf("r.queues.SendEDU: %w", err) } + wakeReq := &api.PerformServersAliveRequest{ + Servers: destinations, + } + wakeRes := &api.PerformServersAliveResponse{} + if err := r.PerformServersAlive(ctx, &wakeReq, &wakeRes); err != nil { + return fmt.Errorf("r.PerformServersAlive: %w", err) + } + return nil }