cql-io 0.9.6 → 0.9.7
raw patch · 5 files changed
+24/−17 lines, 5 files
Files
- CHANGELOG.md +7/−0
- cql-io.cabal +2/−2
- src/Database/CQL/IO/Client.hs +5/−5
- src/Database/CQL/IO/Jobs.hs +4/−4
- src/Database/CQL/IO/Pool.hs +6/−6
+ CHANGELOG.md view
@@ -0,0 +1,7 @@+0.9.7+-----------------------------------------------------------------------------+- Bugfix release.++0.9.6+-----------------------------------------------------------------------------+- Initial release.
cql-io.cabal view
@@ -1,5 +1,5 @@ name: cql-io-version: 0.9.6+version: 0.9.7 synopsis: Cassandra CQL client. stability: experimental license: OtherLicense@@ -12,7 +12,7 @@ category: Database build-type: Simple cabal-version: >= 1.10-extra-source-files: README.md+extra-source-files: README.md, CHANGELOG.md description: CQL Cassandra driver supporting native protocol versions 2 and 3.
src/Database/CQL/IO/Client.hs view
@@ -145,7 +145,7 @@ Nothing -> do err $ msg (val "no pool for host " +++ h) p' <- mkPool (s^.context) (h^.hostAddr)- atomically' $ modifyTVar (s^.hostmap) (Map.alter (maybe (Just p') Just) h)+ atomically' $ modifyTVar' (s^.hostmap) (Map.alter (maybe (Just p') Just) h) start s n action s n p = do@@ -160,7 +160,7 @@ Just q -> retry s q p go s h = do- atomically $ modifyTVar (s^.failures) $ \n -> if n > 0 then n - 1 else 0+ atomically $ modifyTVar' (s^.failures) $ \n -> if n > 0 then n - 1 else 0 transaction s h retry s q p = do@@ -366,7 +366,7 @@ case x of Just a -> a `tryAll` (runClient e . replaceControl) `onException` reconnect e a Nothing -> do- atomically $ modifyTVar (e^.control) (set state Disconnected)+ atomically $ modifyTVar' (e^.control) (set state Disconnected) Logger.fatal (e^.context.logger) $ "error-handler" .= val "no host available" reconnect e a = do@@ -403,7 +403,7 @@ let a = InetAddr $ mapPort prt sa hmap <- view hostmap atomically' $- modifyTVar hmap (Map.filterWithKey (\h _ -> h^.hostAddr /= a))+ modifyTVar' hmap (Map.filterWithKey (\h _ -> h^.hostAddr /= a)) liftIO $ onEvent pol $ HostGone a StatusEvent Up sa -> startMonitor $ (InetAddr $ mapPort prt sa)@@ -417,7 +417,7 @@ okay <- liftIO $ acceptable pol h when okay $ do p <- mkPool ctx (h^.hostAddr)- atomically' $ modifyTVar hmap (Map.alter (maybe (Just p) Just) h)+ atomically' $ modifyTVar' hmap (Map.alter (maybe (Just p) Just) h) liftIO $ onEvent pol $ HostNew h SchemaEvent _ -> return () where
src/Database/CQL/IO/Jobs.hs view
@@ -38,20 +38,20 @@ case Map.lookup k m of Just Reserved -> return (False, Nothing) Just (Running _ a) -> do- modifyTVar d (Map.insert k Reserved)+ modifyTVar' d (Map.insert k Reserved) return (True, Just a) Nothing -> do- modifyTVar d (Map.insert k Reserved)+ modifyTVar' d (Map.insert k Reserved) return (True, Nothing) when ok $ do maybe (return ()) (ignore . cancel) prev u <- newUnique a <- async $ j `finally` remove u atomically $- modifyTVar d (Map.insert k (Running u a))+ modifyTVar' d (Map.insert k (Running u a)) where remove u = atomically $- modifyTVar d $ flip Map.update k $ \a ->+ modifyTVar' d $ flip Map.update k $ \a -> case a of Running u' _ | u == u' -> Nothing _ -> Just a
src/Database/CQL/IO/Pool.hs view
@@ -156,7 +156,7 @@ | otherwise -> retry case r of Left x -> do- atomically (modifyTVar (conns s) (|> x))+ atomically (modifyTVar' (conns s) (|> x)) return x Right x -> return x @@ -172,7 +172,7 @@ | otherwise -> return (return Nothing) case r of Just (Left x) -> do- atomically (modifyTVar (conns s) (|> x))+ atomically (modifyTVar' (conns s) (|> x)) return (Just x) Just (Right x) -> return (Just x) Nothing -> return Nothing@@ -188,7 +188,7 @@ writeTVar (inUse s) $! u + 1 return $ Left <$> onException (Resource <$> p^.currentTime <*> pure 1 <*> pure 0 <*> p^.createFn)- (atomically (modifyTVar (inUse s) (subtract 1)))+ (atomically (modifyTVar' (inUse s) (subtract 1))) {-# INLINE mkNew #-} put :: Pool -> Stripe -> Resource -> (Resource -> Resource) -> IO ()@@ -209,7 +209,7 @@ case find ((value r ==) . value) rs of Nothing -> return () Just _ -> do- modifyTVar (inUse s) (subtract 1)+ modifyTVar' (inUse s) (subtract 1) writeTVar (conns s) $! Seq.filter ((value r /=) . value) rs ignore $ p^.destroyFn $ value r @@ -222,8 +222,8 @@ x <- atomically $ do (stale, okay) <- Seq.partition isStale <$> readTVar (conns s) unless (Seq.null stale) $ do- writeTVar (conns s) okay- modifyTVar (inUse s) (subtract (Seq.length stale))+ writeTVar (conns s) okay+ modifyTVar' (inUse s) (subtract (Seq.length stale)) return stale forM_ x $ \v -> ignore $ do trace (p^.logger) $ "reap" .= show (value v)