From 0fe0e2301dfd3855635860bf640ab5036f80b515 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 10 Dec 2020 11:00:17 +0000 Subject: [PATCH] Don't repeat outbound peeks for the same room ID to the same servers --- federationsender/internal/perform.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index 02ea32df5..3adf8fc94 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -292,6 +292,16 @@ func (r *FederationSenderInternalAPI) PerformOutboundPeek( } request.ServerNames = uniqueList + // See if there's an existing outbound peek for this room ID with + // one of the specified servers. + if peeks, err := r.db.GetOutboundPeeks(ctx, request.RoomID); err == nil { + for _, peek := range peeks { + if _, ok := seenSet[peek.ServerName]; ok { + return nil + } + } + } + // Try each server that we were provided until we land on one that // successfully completes the peek var lastErr error