packages feed

haskoin-store 0.40.16 → 0.40.17

raw patch · 2 files changed

+28/−22 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

haskoin-store.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           haskoin-store-version:        0.40.16+version:        0.40.17 synopsis:       Storage and index for Bitcoin and Bitcoin Cash description:    Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme> category:       Bitcoin, Finance, Network
src/Haskoin/Store/Cache.hs view
@@ -533,7 +533,7 @@     if s > x then flush (s - x) else return 0   where     flush n =-        case min 1000 (n `div` 64) of+        case n `div` 64 of         0 -> return 0         x -> withLockForever $ do             ks <- fmap (map fst) . runRedis $@@ -579,25 +579,31 @@   where     op XPubUnspent {xPubUnspent = u} = (unspentPoint u, unspentBlock u)     go bals = do-        xpubtxt <- xpubText xpub-        $(logDebugS) "Cache" $-            "Caching " <> xpubtxt <> ": " <> cs (show (length bals)) <>-            " addresses / " <> cs (show (lenNotNull bals)) <> " used"-        utxo <- lift $ xPubUnspents xpub def-        $(logDebugS) "Cache" $-            "Caching " <> xpubtxt <> ": " <> cs (show (length utxo)) <> " utxos"-        xtxs <- lift $ xPubTxs xpub def-        $(logDebugS) "Cache" $-            "Caching " <> xpubtxt <> ": " <> cs (show (length xtxs)) <> " txs"-        now <- systemSeconds <$> liftIO getSystemTime-        runRedis $ do-            b <- redisTouchKeys now [xpub]-            c <- redisAddXPubBalances xpub bals-            d <- redisAddXPubUnspents xpub (map op utxo)-            e <- redisAddXPubTxs xpub xtxs-            return $ b >> c >> d >> e >> return ()-        $(logDebugS) "Cache" $ "Cached " <> xpubtxt-        return (True, bals)+        m <- withLockRetry 10 $ do+            xpubtxt <- xpubText xpub+            $(logDebugS) "Cache" $+                "Caching " <> xpubtxt <> ": " <> cs (show (length bals)) <>+                " addresses / " <> cs (show (lenNotNull bals)) <>+                " used"+            utxo <- lift $ xPubUnspents xpub def+            $(logDebugS) "Cache" $+                "Caching " <> xpubtxt <> ": " <> cs (show (length utxo)) <>+                " utxos"+            xtxs <- lift $ xPubTxs xpub def+            $(logDebugS) "Cache" $+                "Caching " <> xpubtxt <> ": " <> cs (show (length xtxs)) <>+                " txs"+            now <- systemSeconds <$> liftIO getSystemTime+            runRedis $ do+                b <- redisTouchKeys now [xpub]+                c <- redisAddXPubBalances xpub bals+                d <- redisAddXPubUnspents xpub (map op utxo)+                e <- redisAddXPubTxs xpub xtxs+                return $ b >> c >> d >> e >> return ()+            $(logDebugS) "Cache" $ "Cached " <> xpubtxt+        case m of+            Nothing -> return (False, bals)+            Just () -> return (True, bals)  inSync :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m)        => CacheX m Bool@@ -1012,7 +1018,7 @@     -> CacheT m () evictFromCache xpubs = ask >>= \case     Nothing -> return ()-    Just cfg -> void (runReaderT (delXPubKeys xpubs) cfg)+    Just cfg -> void (runReaderT (withLockRetry 100 (delXPubKeys xpubs)) cfg)  delXPubKeys ::        (MonadUnliftIO m, MonadLoggerIO m, StoreReadBase m)