diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
+## 0.22.3
+### Fixed
+- Bug was making cache get stuck when pruning.
+
 ## 0.22.2
 ### Changed
 - More efficient algorithms for caching and cache misses.
diff --git a/haskoin-store.cabal b/haskoin-store.cabal
--- a/haskoin-store.cabal
+++ b/haskoin-store.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 7a0c5880e387abb80513ece5fc14ba5c2d3b10d5eec8fe814d1eba0c88e7ffeb
+-- hash: c8bf74e00554aae1150db4899a8a884aa02460f8ceee92438039b164087e4cab
 
 name:           haskoin-store
-version:        0.22.2
+version:        0.22.3
 synopsis:       Storage and index for Bitcoin and Bitcoin Cash
 description:    Store and index Bitcoin or Bitcoin Cash blocks, transactions, balances and unspent outputs.
                 All data is available via REST API in JSON or binary format.
diff --git a/src/Haskoin/Store/Cache.hs b/src/Haskoin/Store/Cache.hs
--- a/src/Haskoin/Store/Cache.hs
+++ b/src/Haskoin/Store/Cache.hs
@@ -62,29 +62,16 @@
                                             xPubWitnessAddr)
 import           Haskoin.Node              (Chain, chainGetAncestor,
                                             chainGetBlock, chainGetSplitBlock)
-import Haskoin.Store.Common
-    ( Balance(..)
-    , BlockData(..)
-    , BlockRef(..)
-    , BlockTx(..)
-    , DeriveType(..)
-    , Limit
-    , Offset
-    , Prev(..)
-    , StoreRead(..)
-    , StoreRead(..)
-    , TxData(..)
-    , Unspent(..)
-    , XPubBal(..)
-    , XPubSpec(..)
-    , XPubUnspent(..)
-    , nullBalance
-    , sortTxs
-    , xPubBals
-    , xPubBalsTxs
-    , xPubBalsUnspents
-    , xPubTxs
-    )
+import           Haskoin.Store.Common      (Balance (..), BlockData (..),
+                                            BlockRef (..), BlockTx (..),
+                                            DeriveType (..), Limit, Offset,
+                                            Prev (..), StoreRead (..),
+                                            StoreRead (..), TxData (..),
+                                            Unspent (..), XPubBal (..),
+                                            XPubSpec (..), XPubUnspent (..),
+                                            nullBalance, sortTxs, xPubBals,
+                                            xPubBalsTxs, xPubBalsUnspents,
+                                            xPubTxs)
 import           NQE                       (Inbox, Mailbox, receive)
 import           UnliftIO                  (Exception, MonadIO, MonadUnliftIO,
                                             liftIO, throwIO)
@@ -452,18 +439,15 @@
             return n
         else return 0
   where
-    flush n = do
-        n' <-
-            runRedisReply $ do
-                eks <- getFromSortedSet maxKey Nothing 0 (Just 10)
-                case eks of
-                    Right ks -> do
-                        xs <- sequence <$> forM (map fst ks) redisDelXPubKeys
-                        return $ xs >>= return . sum
-                    Left _ -> return $ eks >> return 0
-        if n <= n'
-            then return n'
-            else (n' +) <$> flush (n - n')
+    flush n =
+        runRedisReply $ do
+            let x = min 1000 (n `div` 64)
+            eks <- getFromSortedSet maxKey Nothing 0 (Just x)
+            case eks of
+                Right ks -> do
+                    xs <- sequence <$> forM (map fst ks) redisDelXPubKeys
+                    return $ xs >>= return . sum
+                Left _ -> return $ eks >> return 0
 
 touchKeys :: Real a => a -> [XPubSpec] -> RedisReply Integer
 touchKeys _ [] = return (pure 0)
