mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-02-22 02:44:28 -06:00
Don't hold lock while sending transaction
This commit is contained in:
parent
36356ac8d1
commit
8861f907ed
|
@ -279,11 +279,13 @@ func (oq *destinationQueue) backgroundSend() {
|
||||||
if eduCount > maxEDUsPerTransaction {
|
if eduCount > maxEDUsPerTransaction {
|
||||||
eduCount = maxEDUsPerTransaction
|
eduCount = maxEDUsPerTransaction
|
||||||
}
|
}
|
||||||
|
toSendPDUs := oq.pendingPDUs[:pduCount]
|
||||||
|
toSendEDUs := oq.pendingEDUs[:eduCount]
|
||||||
|
oq.pendingMutex.RUnlock()
|
||||||
|
|
||||||
// If we have pending PDUs or EDUs then construct a transaction.
|
// If we have pending PDUs or EDUs then construct a transaction.
|
||||||
// Try sending the next transaction and see what happens.
|
// Try sending the next transaction and see what happens.
|
||||||
transaction, pc, ec, terr := oq.nextTransaction(oq.pendingPDUs[:pduCount], oq.pendingEDUs[:eduCount])
|
transaction, pc, ec, terr := oq.nextTransaction(toSendPDUs, toSendEDUs)
|
||||||
oq.pendingMutex.RUnlock()
|
|
||||||
if terr != nil {
|
if terr != nil {
|
||||||
// We failed to send the transaction. Mark it as a failure.
|
// We failed to send the transaction. Mark it as a failure.
|
||||||
oq.statistics.Failure()
|
oq.statistics.Failure()
|
||||||
|
|
Loading…
Reference in a new issue