mirror of https://github.com/voidlizard/hbs2
better. most probably fix rpc lock issue
This commit is contained in:
parent
8ca4dd79bf
commit
3e4762d880
|
@ -121,22 +121,13 @@ makeRequest rnum input = ServiceRequest rnum (serialise (fromIntegral idx :: Int
|
||||||
where
|
where
|
||||||
idx = findMethodIndex @method @api
|
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))
|
makeRequestR :: forall api method e m . ( KnownNat (FromJust (FindMethodIndex 0 method api))
|
||||||
, Serialise (Input method)
|
, Serialise (Input method)
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> Input method -> m (ServiceProto api e)
|
=> Input method -> m (ServiceProto api e)
|
||||||
makeRequestR input = do
|
makeRequestR input = do
|
||||||
n <- liftIO $ randomIO @Word64
|
rnum <- liftIO $ randomIO @Word64
|
||||||
rnum <- atomically do
|
|
||||||
n <- readTVar rnumnum
|
|
||||||
modifyTVar' rnumnum succ
|
|
||||||
pure (fromIntegral n)
|
|
||||||
|
|
||||||
pure $ ServiceRequest rnum (serialise (fromIntegral idx :: Int, serialise input))
|
pure $ ServiceRequest rnum (serialise (fromIntegral idx :: Int, serialise input))
|
||||||
where
|
where
|
||||||
idx = findMethodIndex @method @api
|
idx = findMethodIndex @method @api
|
||||||
|
|
Loading…
Reference in New Issue