mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
Still write events into database for blacklisted hosts (they can be tidied up later)
This commit is contained in:
parent
dd7df49d6a
commit
213ca2d039
|
|
@ -66,11 +66,6 @@ type destinationQueue struct {
|
||||||
// If the queue is empty then it starts a background goroutine to
|
// If the queue is empty then it starts a background goroutine to
|
||||||
// start sending events to that destination.
|
// start sending events to that destination.
|
||||||
func (oq *destinationQueue) sendEvent(receipt *shared.Receipt) {
|
func (oq *destinationQueue) sendEvent(receipt *shared.Receipt) {
|
||||||
if oq.statistics.Blacklisted() {
|
|
||||||
// If the destination is blacklisted then drop the event.
|
|
||||||
log.Infof("%s is blacklisted; dropping event", oq.destination)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Create a transaction ID. We'll either do this if we don't have
|
// Create a transaction ID. We'll either do this if we don't have
|
||||||
// one made up yet, or if we've exceeded the number of maximum
|
// one made up yet, or if we've exceeded the number of maximum
|
||||||
// events allowed in a single tranaction. We'll reset the counter
|
// events allowed in a single tranaction. We'll reset the counter
|
||||||
|
|
@ -97,6 +92,9 @@ func (oq *destinationQueue) sendEvent(receipt *shared.Receipt) {
|
||||||
// We've successfully added a PDU to the transaction so increase
|
// We've successfully added a PDU to the transaction so increase
|
||||||
// the counter.
|
// the counter.
|
||||||
oq.transactionCount.Add(1)
|
oq.transactionCount.Add(1)
|
||||||
|
// Check if the destination is blacklisted. If it isn't then wake
|
||||||
|
// up the queue.
|
||||||
|
if !oq.statistics.Blacklisted() {
|
||||||
// Wake up the queue if it's asleep.
|
// Wake up the queue if it's asleep.
|
||||||
oq.wakeQueueIfNeeded()
|
oq.wakeQueueIfNeeded()
|
||||||
// If we're blocking on waiting PDUs then tell the queue that we
|
// If we're blocking on waiting PDUs then tell the queue that we
|
||||||
|
|
@ -106,16 +104,12 @@ func (oq *destinationQueue) sendEvent(receipt *shared.Receipt) {
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sendEDU adds the EDU event to the pending queue for the destination.
|
// sendEDU adds the EDU event to the pending queue for the destination.
|
||||||
// If the queue is empty then it starts a background goroutine to
|
// If the queue is empty then it starts a background goroutine to
|
||||||
// start sending events to that destination.
|
// start sending events to that destination.
|
||||||
func (oq *destinationQueue) sendEDU(receipt *shared.Receipt) {
|
func (oq *destinationQueue) sendEDU(receipt *shared.Receipt) {
|
||||||
if oq.statistics.Blacklisted() {
|
|
||||||
// If the destination is blacklisted then drop the event.
|
|
||||||
log.Infof("%s is blacklisted; dropping ephemeral event", oq.destination)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Create a database entry that associates the given PDU NID with
|
// Create a database entry that associates the given PDU NID with
|
||||||
// this destination queue. We'll then be able to retrieve the PDU
|
// this destination queue. We'll then be able to retrieve the PDU
|
||||||
// later.
|
// later.
|
||||||
|
|
@ -130,15 +124,19 @@ func (oq *destinationQueue) sendEDU(receipt *shared.Receipt) {
|
||||||
// We've successfully added an EDU to the transaction so increase
|
// We've successfully added an EDU to the transaction so increase
|
||||||
// the counter.
|
// the counter.
|
||||||
oq.transactionCount.Add(1)
|
oq.transactionCount.Add(1)
|
||||||
|
// Check if the destination is blacklisted. If it isn't then wake
|
||||||
|
// up the queue.
|
||||||
|
if !oq.statistics.Blacklisted() {
|
||||||
// Wake up the queue if it's asleep.
|
// Wake up the queue if it's asleep.
|
||||||
oq.wakeQueueIfNeeded()
|
oq.wakeQueueIfNeeded()
|
||||||
// If we're blocking on waiting PDUs then tell the queue that we
|
// If we're blocking on waiting EDUs then tell the queue that we
|
||||||
// have work to do.
|
// have work to do.
|
||||||
select {
|
select {
|
||||||
case oq.notifyEDUs <- true:
|
case oq.notifyEDUs <- true:
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sendInvite adds the invite event to the pending queue for the
|
// sendInvite adds the invite event to the pending queue for the
|
||||||
// destination. If the queue is empty then it starts a background
|
// destination. If the queue is empty then it starts a background
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue