mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Review comments
This commit is contained in:
parent
b73139e68c
commit
743a3d783f
|
|
@ -94,8 +94,11 @@ func (oq *destinationQueue) sendInvite(ev *gomatrixserverlib.InviteV2Request) {
|
|||
// backgroundSend is the worker goroutine for sending events.
|
||||
// nolint:gocyclo
|
||||
func (oq *destinationQueue) backgroundSend() {
|
||||
// Mark the worker as running for its lifetime.
|
||||
oq.running.Store(true)
|
||||
// Check if a worker is already running, and if it isn't, then
|
||||
// mark it as started.
|
||||
if !oq.running.CAS(false, true) {
|
||||
return
|
||||
}
|
||||
defer oq.running.Store(false)
|
||||
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func (oqs *OutgoingQueues) SendEvent(
|
|||
}
|
||||
|
||||
// Remove our own server from the list of destinations.
|
||||
destinations = filterDestinations(oqs.origin, destinations)
|
||||
destinations = filterAndDedupeDests(oqs.origin, destinations)
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"destinations": destinations, "event": ev.EventID(),
|
||||
|
|
@ -145,7 +145,7 @@ func (oqs *OutgoingQueues) SendEDU(
|
|||
}
|
||||
|
||||
// Remove our own server from the list of destinations.
|
||||
destinations = filterDestinations(oqs.origin, destinations)
|
||||
destinations = filterAndDedupeDests(oqs.origin, destinations)
|
||||
|
||||
if len(destinations) > 0 {
|
||||
log.WithFields(log.Fields{
|
||||
|
|
@ -160,9 +160,9 @@ func (oqs *OutgoingQueues) SendEDU(
|
|||
return nil
|
||||
}
|
||||
|
||||
// filterDestinations removes our own server from the list of destinations.
|
||||
// Otherwise we could end up trying to talk to ourselves.
|
||||
func filterDestinations(origin gomatrixserverlib.ServerName, destinations []gomatrixserverlib.ServerName) (
|
||||
// filterAndDedupeDests removes our own server from the list of destinations
|
||||
// and deduplicates any servers in the list that may appear more than once.
|
||||
func filterAndDedupeDests(origin gomatrixserverlib.ServerName, destinations []gomatrixserverlib.ServerName) (
|
||||
result []gomatrixserverlib.ServerName,
|
||||
) {
|
||||
strs := make([]string, len(destinations))
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package internal
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
|
@ -68,7 +67,6 @@ func (r *RoomserverInternalAPI) InputRoomEvents(
|
|||
// loopback room event containing the invite, for local invites.
|
||||
// If it does, we should process it with the room events below.
|
||||
if loopback != nil {
|
||||
fmt.Println("LOOPING BACK", string(loopback.Event.JSON()))
|
||||
request.InputRoomEvents = append(request.InputRoomEvents, *loopback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue