graph: updated builder to use atomic ints

Instead of relying on devs to remember that they must only be accessed
atomically.
This commit is contained in:
Elle Mouton committed 2024-07-15 15:56:33 +02:00
1 parent fe34d62eb1
commit 90dff730ce
3 files changed
+12 -16

No files matched your search

+1 -2
View File
@@ -5,7 +5,6 @@ import (
"image/color"
"net"
"sync"
"sync/atomic"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil"
@@ -65,7 +64,7 @@ func (b *Builder) SubscribeTopology() (*TopologyClient, error) {
// We'll first atomically obtain the next ID for this client from the
// incrementing client ID counter.
clientID := atomic.AddUint64(&b.ntfnClientCounter, 1)
clientID := b.ntfnClientCounter.Add(1)
log.Debugf("New graph topology client subscription, client %v",
clientID)