Skip to content

Commit

Permalink
Remove redundant force calls in updatePeerDb
Browse files Browse the repository at this point in the history
This code is already strict enough. ixset-typed is a set and a strict
list of maps. When updated, ixset-typed will force the set and maps
to whnf, and insert the new element into a Set. Sets are strict in 
their elements and maps are strict in their keys, and the value type
`PeerEntry` is itself strict in its components.
  • Loading branch information
edmundnoble committed Nov 14, 2024
1 parent 75ab5b5 commit b4a4db0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/P2P/Node/PeerDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ updatePeerDb (PeerDb _ _ _ lock var) a f
= withMVar lock . const . atomically . modifyTVar' var $ \s ->
case getOne $ getEQ a s of
Nothing -> s
Just x -> force $ updateIx a (force $ f x) s
Just x -> updateIx a (f x) s

incrementActiveSessionCount :: PeerDb -> PeerInfo -> IO ()
incrementActiveSessionCount db i
Expand Down

0 comments on commit b4a4db0

Please sign in to comment.