kafka-client-sync 0.1.1.0 → 0.1.1.1
raw patch · 4 files changed
+27/−7 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- kafka-client-sync.cabal +8/−2
- src/Kafka/Producer/Sync.hs +4/−2
- test/Main.hs +11/−3
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for kafka-client-sync +## 0.1.1.1 -- 2020-01-17++* Fix concurrency issue causing deadlock in callback handler+ ## 0.1.1.0 -- 2019-11-12 * Add `closeSyncProducer` function
kafka-client-sync.cabal view
@@ -1,7 +1,7 @@ name: kafka-client-sync version:- 0.1.1.0+ 0.1.1.1 synopsis: Synchronous Kafka Client description:@@ -66,7 +66,13 @@ Main.hs ghc-options:- -Wall -Wredundant-constraints -fhide-source-paths -threaded+ -Wall+ -Wredundant-constraints+ -fhide-source-paths+ -threaded+ -with-rtsopts=-N+ -with-rtsopts=-qg+ -O2 hs-source-dirs: test
src/Kafka/Producer/Sync.hs view
@@ -49,7 +49,9 @@ import Prelude +import Control.Concurrent (forkIO) import Control.Concurrent.MVar (MVar, newMVar, takeMVar, newEmptyMVar, putMVar)+import Control.Monad (void) import Control.Monad.IO.Class (MonadIO(..)) import Data.Foldable (find) import Data.Functor ((<&>))@@ -186,7 +188,7 @@ handleDeliveryReport :: MVar Requests -> (DeliveryReport -> IO ()) handleDeliveryReport mvarRequests = \case- DeliverySuccess record _offset -> do+ DeliverySuccess record _offset -> void . forkIO $ do reqs <- takeMVar mvarRequests case getAndRemove record (sent reqs) of Just (mvar, rest) -> do@@ -196,7 +198,7 @@ error $ "Illegal state ocurred, record was not in sent: " <> show reqs- DeliveryFailure record err -> do+ DeliveryFailure record err -> void . forkIO $ do reqs <- takeMVar mvarRequests case getAndRemove record (sent reqs) of Just (mvar, rest) -> do
test/Main.hs view
@@ -13,7 +13,7 @@ producerProps :: ProducerProperties producerProps = brokersList [BrokerAddress "localhost:9092"]- <> sendTimeout (Timeout 10000)+ <> sendTimeout (Timeout 1000) <> logLevel KafkaLogDebug message :: Int -> ProducerRecord@@ -41,9 +41,17 @@ putStrLn "Running Kafka sync tests" let action = produceRecord producer . message++ -- Produces 15k messages and waits for them all to be delivered to the+ -- broker res <- sequence $- fmap action [1..100] ++- fmap action (replicate 1 100)+ fmap action [1..10000] +++ fmap action (replicate 1 1000) +++ fmap action (replicate 2 1000) +++ fmap action (replicate 3 1000) +++ fmap action (replicate 4 1000) +++ fmap action (replicate 5 1000) +++ [] for_ res $ either (putStrLn . (<>) "got error: " . show) pure