mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
Clean up transaction properly
This commit is contained in:
parent
3419a7450b
commit
cef07c4e4e
|
|
@ -252,14 +252,6 @@ func (oq *destinationQueue) backgroundSend() {
|
||||||
oq.transactionID = ""
|
oq.transactionID = ""
|
||||||
// Clean up the in-memory buffers.
|
// Clean up the in-memory buffers.
|
||||||
oq.cleanPendingEDUs()
|
oq.cleanPendingEDUs()
|
||||||
// Clean up the transaction in the database.
|
|
||||||
if err := oq.db.CleanTransactionPDUs(
|
|
||||||
context.TODO(),
|
|
||||||
oq.destination,
|
|
||||||
transactionID,
|
|
||||||
); err != nil {
|
|
||||||
log.WithError(err).Errorf("failed to clean transaction %q for server %q", transactionID, oq.destination)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -359,7 +351,15 @@ func (oq *destinationQueue) nextTransaction(
|
||||||
switch e := err.(type) {
|
switch e := err.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
// No error was returned so the transaction looks to have
|
// No error was returned so the transaction looks to have
|
||||||
// been successfully sent.
|
// been successfully sent. Clean up the transaction in the
|
||||||
|
// database.
|
||||||
|
if err = oq.db.CleanTransactionPDUs(
|
||||||
|
context.TODO(),
|
||||||
|
t.Destination,
|
||||||
|
t.TransactionID,
|
||||||
|
); err != nil {
|
||||||
|
log.WithError(err).Errorf("failed to clean transaction %q for server %q", transactionID, oq.destination)
|
||||||
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
case gomatrix.HTTPError:
|
case gomatrix.HTTPError:
|
||||||
// We received a HTTP error back. In this instance we only
|
// We received a HTTP error back. In this instance we only
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue