From 3e4762d88096eab788dbe670206d83094f3485c0 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Sat, 15 Feb 2025 14:00:29 +0300 Subject: [PATCH] better. most probably fix rpc lock issue --- hbs2-core/lib/HBS2/Net/Proto/Service.hs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hbs2-core/lib/HBS2/Net/Proto/Service.hs b/hbs2-core/lib/HBS2/Net/Proto/Service.hs index 6f259690..6434d707 100644 --- a/hbs2-core/lib/HBS2/Net/Proto/Service.hs +++ b/hbs2-core/lib/HBS2/Net/Proto/Service.hs @@ -121,22 +121,13 @@ makeRequest rnum input = ServiceRequest rnum (serialise (fromIntegral idx :: Int where idx = findMethodIndex @method @api -rnumnum :: TVar Word64 -rnumnum = unsafePerformIO (newTVarIO 1) -{-# NOINLINE rnumnum #-} - makeRequestR :: forall api method e m . ( KnownNat (FromJust (FindMethodIndex 0 method api)) , Serialise (Input method) , MonadIO m ) => Input method -> m (ServiceProto api e) makeRequestR input = do - n <- liftIO $ randomIO @Word64 - rnum <- atomically do - n <- readTVar rnumnum - modifyTVar' rnumnum succ - pure (fromIntegral n) - + rnum <- liftIO $ randomIO @Word64 pure $ ServiceRequest rnum (serialise (fromIntegral idx :: Int, serialise input)) where idx = findMethodIndex @method @api