mirror of
https://github.com/higherkindness/mu-haskell.git
synced 2024-10-26 15:49:00 +03:00
Do not create a loop in bidi gRPC (#306)
Co-authored-by: Flavio Corpa <flavio.corpa@47deg.com>
This commit is contained in:
parent
26b4fc9ec6
commit
75e7554603
@ -465,15 +465,15 @@ instance (GRpcInputWrapper p vref v, GRpcOutputWrapper p rref r, MonadIO m)
|
||||
cstreamFinalizer _
|
||||
= liftIO $ atomically (closeTMChan chan) >> wait promise
|
||||
readNext _
|
||||
= do nextOutput <- liftIO $ atomically $ tryTakeTMVar var
|
||||
= do nextOutput <- liftIO $ atomically $ takeTMVar var
|
||||
case nextOutput of
|
||||
Just (Just o) ->
|
||||
Just o ->
|
||||
pure $ Just ((), buildGRpcOWTy (Proxy @p) (Proxy @rref) o)
|
||||
Just Nothing -> do
|
||||
Nothing -> do
|
||||
liftIO $ cancel promise
|
||||
pure Nothing
|
||||
Nothing -> -- no new elements to output
|
||||
readNext ()
|
||||
-- Nothing -> -- no new elements to output
|
||||
-- readNext ()
|
||||
pure ((), IncomingStream cstreamHandler cstreamFinalizer, (), OutgoingStream readNext)
|
||||
|
||||
-----
|
||||
|
Loading…
Reference in New Issue
Block a user