mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -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,
|
||||
receipt *receipt.Receipt,
|
||||
) 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(
|
||||
ctx, txn, transactionID, destination.Domain(), receipt.GetNID())
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("d.insertQueueEntry: %w", err)
|
||||
ctx,
|
||||
txn,
|
||||
transactionID,
|
||||
destination.Domain(),
|
||||
receipt.GetNID(),
|
||||
)
|
||||
if err != nil {
|
||||
lastErr = fmt.Errorf("d.insertQueueEntry: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return lastErr
|
||||
})
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *Database) CleanTransactions(
|
||||
|
|
|
|||
Loading…
Reference in a new issue