prevent threads not awaiting migration from blocking their response

This commit is contained in:
Trolli Schmittlauch 2020-08-17 11:37:04 +02:00
parent c49c1a89c9
commit b8cedada48

View file

@ -232,7 +232,9 @@ subscriptionDelivery serv senderID subList = do
:: STM (Either String ()))
-- TODO: should this always signal migration finished to avoid deadlocksP
liftIO $ putMVar syncMVar () -- wakes up waiting thread
liftIO $ putMVar syncMVar () -- blocks until waiting thread has resumed
-- allow response to be completed independently from waiting thread
_ <- liftIO . forkIO $ do
putMVar syncMVar () -- blocks until waiting thread has resumed
-- delete this migration from ongoing ones
liftIO . atomically $ modifyTVar' (migrationsInProgress serv) $
HMap.delete (fromInteger senderID)