wip, hunting busyloops

This commit is contained in:
voidlizard 2025-03-04 18:43:46 +03:00
parent a85a95d1f2
commit cc001b0451
3 changed files with 27 additions and 17 deletions

View File

@ -1319,6 +1319,11 @@ runPeer opts = respawnOnError opts $ do
setProbe rpcmsg rpcProbe setProbe rpcmsg rpcProbe
addProbe rpcProbe addProbe rpcProbe
let doCleanupByPassMessaging = withPeerM penv do
debug $ red "doCleanupByPassMessaging"
pips <- getKnownPeers @L4Proto
cleanupByPassMessaging byPass pips
let rpcctx = RPC2Context { rpcSelf = myself let rpcctx = RPC2Context { rpcSelf = myself
, rpcConfig = fromPeerConfig conf , rpcConfig = fromPeerConfig conf
, rpcMessaging = rpcmsg , rpcMessaging = rpcmsg
@ -1331,6 +1336,7 @@ runPeer opts = respawnOnError opts $ do
, rpcByPassInfo = liftIO (getStat byPass) , rpcByPassInfo = liftIO (getStat byPass)
, rpcProbes = probes , rpcProbes = probes
, rpcDoFetch = liftIO . fetchHash penv , rpcDoFetch = liftIO . fetchHash penv
, rpcCleanupByPassMessaging = doCleanupByPassMessaging
, rpcDoRefChanHeadPost = refChanHeadPostAction , rpcDoRefChanHeadPost = refChanHeadPostAction
, rpcDoRefChanPropose = refChanProposeAction , rpcDoRefChanPropose = refChanProposeAction
, rpcDoRefChanNotify = refChanNotifyAction , rpcDoRefChanNotify = refChanNotifyAction

View File

@ -218,6 +218,9 @@ instance (e ~ L4Proto, MonadUnliftIO m, HasRpcContext PeerAPI RPC2Context m) =>
_ -> do _ -> do
pure nil pure nil
entry $ bindMatch "test:cleanupByPassMessaging" $ const $ do
liftIO rpcCleanupByPassMessaging
pure $ mkSym "done"
entry $ bindMatch "test:explode" $ const do entry $ bindMatch "test:explode" $ const do

View File

@ -32,23 +32,24 @@ import HBS2.Prelude (asyncLinked)
data RPC2Context = data RPC2Context =
RPC2Context RPC2Context
{ rpcSelf :: ThreadId { rpcSelf :: ThreadId
, rpcConfig :: [Syntax C] , rpcConfig :: [Syntax C]
, rpcMessaging :: MessagingUnix , rpcMessaging :: MessagingUnix
, rpcTCP :: Maybe MessagingTCP , rpcTCP :: Maybe MessagingTCP
, rpcPokeAnswer :: String , rpcPokeAnswer :: String
, rpcPeerEnv :: PeerEnv L4Proto , rpcPeerEnv :: PeerEnv L4Proto
, rpcLocalMultiCast :: Peer L4Proto , rpcLocalMultiCast :: Peer L4Proto
, rpcStorage :: AnyStorage , rpcStorage :: AnyStorage
, rpcBrains :: SomeBrains L4Proto , rpcBrains :: SomeBrains L4Proto
, rpcByPassInfo :: IO ByPassStat , rpcByPassInfo :: IO ByPassStat
, rpcProbes :: TVar [AnyProbe] , rpcProbes :: TVar [AnyProbe]
, rpcDoFetch :: HashRef -> IO () , rpcCleanupByPassMessaging :: IO ()
, rpcDoRefChanHeadPost :: HashRef -> IO () , rpcDoFetch :: HashRef -> IO ()
, rpcDoRefChanPropose :: (PubKey 'Sign 'HBS2Basic, SignedBox ByteString 'HBS2Basic) -> IO () , rpcDoRefChanHeadPost :: HashRef -> IO ()
, rpcDoRefChanNotify :: (PubKey 'Sign 'HBS2Basic, SignedBox ByteString 'HBS2Basic) -> IO () , rpcDoRefChanPropose :: (PubKey 'Sign 'HBS2Basic, SignedBox ByteString 'HBS2Basic) -> IO ()
, rpcMailboxService :: AnyMailboxService HBS2Basic , rpcDoRefChanNotify :: (PubKey 'Sign 'HBS2Basic, SignedBox ByteString 'HBS2Basic) -> IO ()
, rpcMailboxAdapter :: AnyMailboxAdapter HBS2Basic , rpcMailboxService :: AnyMailboxService HBS2Basic
, rpcMailboxAdapter :: AnyMailboxAdapter HBS2Basic
} }
instance (Monad m, Messaging MessagingUnix UNIX (Encoded UNIX)) => HasFabriq UNIX (ReaderT RPC2Context m) where instance (Monad m, Messaging MessagingUnix UNIX (Encoded UNIX)) => HasFabriq UNIX (ReaderT RPC2Context m) where