mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-21 21:13:09 -06:00
Insert relay transaction destinations in a single db transaction
This commit is contained in:
parent
cbad03fc5e
commit
5833c86aca
|
|
@ -65,18 +65,25 @@ func (d *Database) AssociateTransactionWithDestinations(
|
||||||
transactionID gomatrixserverlib.TransactionID,
|
transactionID gomatrixserverlib.TransactionID,
|
||||||
receipt *receipt.Receipt,
|
receipt *receipt.Receipt,
|
||||||
) error {
|
) error {
|
||||||
for destination := range destinations {
|
err := d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||||
err := d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
var lastErr error
|
||||||
|
for destination := range destinations {
|
||||||
|
destination := destination
|
||||||
err := d.RelayQueue.InsertQueueEntry(
|
err := d.RelayQueue.InsertQueueEntry(
|
||||||
ctx, txn, transactionID, destination.Domain(), receipt.GetNID())
|
ctx,
|
||||||
return err
|
txn,
|
||||||
})
|
transactionID,
|
||||||
if err != nil {
|
destination.Domain(),
|
||||||
return fmt.Errorf("d.insertQueueEntry: %w", err)
|
receipt.GetNID(),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
lastErr = fmt.Errorf("d.insertQueueEntry: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return lastErr
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) CleanTransactions(
|
func (d *Database) CleanTransactions(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue