haskoin-store 0.22.2 → 0.22.3
raw patch · 3 files changed
+25/−37 lines, 3 files
Files
- CHANGELOG.md +4/−0
- haskoin-store.cabal +2/−2
- src/Haskoin/Store/Cache.hs +19/−35
CHANGELOG.md view
@@ -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.
haskoin-store.cabal view
@@ -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.
src/Haskoin/Store/Cache.hs view
@@ -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)