channeldb: use the Batch method when writing payment details
This commit implements an easy optimization by using bolt db’s Batch method when writing payment details to disk. The AddPaymnent method can be concurrently called by thousands of grouting due to the way the payment dispatch pipeline is architected. With this commit, we shave of a significant amount of running time when users are sending thousands of payments a second as what would’ve been thousands of writes can now be coalesced into one or two writes!
This commit is contained in:
parent
a22ba92630
commit
fe3c3642e2
@ -62,7 +62,7 @@ func (db *DB) AddPayment(payment *OutgoingPayment) error {
|
||||
}
|
||||
paymentBytes := b.Bytes()
|
||||
|
||||
return db.Update(func(tx *bolt.Tx) error {
|
||||
return db.Batch(func(tx *bolt.Tx) error {
|
||||
payments, err := tx.CreateBucketIfNotExists(paymentBucket)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user