Skip to content

Commit

Permalink
Reorder STM actions:
Browse files Browse the repository at this point in the history
This change binds useLedgerPeers after unblocking due to a demand
for ledger peers by its clients. If this value has changed in the
configuration while the thread was dormant, ie. a race, it will be
picked up when the function unblocks.
  • Loading branch information
crocodile-dentist committed Apr 29, 2024
1 parent 8f89eaf commit 9c46f1e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,16 @@ ledgerPeersThread PeerActionsDNS {
-> Map AccPoolStake (PoolStake, NonEmpty RelayAccessPoint)
-> m Void
go rng oldTs peerMap bigPeerMap = do
useLedgerPeers <- atomically wlpGetUseLedgerPeers
traceWith wlpTracer WaitingOnRequest
-- wait until next request of ledger peers
((numRequested, ledgerPeersKind), useLedgerPeers) <- atomically $
(,) <$> getReq <*> wlpGetUseLedgerPeers
traceWith wlpTracer (TraceUseLedgerPeers useLedgerPeers)

let peerListLifeTime = if Map.null peerMap && isLedgerPeersEnabled useLedgerPeers
then short_PEER_LIST_LIFE_TIME
else long_PEER_LIST_LIFE_TIME

traceWith wlpTracer WaitingOnRequest
-- wait until next request of ledger peers
(numRequested, ledgerPeersKind) <- atomically getReq
traceWith wlpTracer $ RequestForPeers numRequested
!now <- getMonotonicTime
let age = diffTime now oldTs
Expand Down

0 comments on commit 9c46f1e

Please sign in to comment.