Don't repeat outbound peeks for the same room ID to the same servers

This commit is contained in:
Neil Alexander 2020-12-10 11:00:17 +00:00
parent d47ab1f3b9
commit 0fe0e2301d
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -292,6 +292,16 @@ func (r *FederationSenderInternalAPI) PerformOutboundPeek(
} }
request.ServerNames = uniqueList 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 // Try each server that we were provided until we land on one that
// successfully completes the peek // successfully completes the peek
var lastErr error var lastErr error