packages feed

haskoin-store 0.40.4 → 0.40.5

raw patch · 4 files changed

+14/−31 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Haskoin.Store.Web: [webReqLog] :: WebConfig -> !Bool
- Haskoin.Store.Web: WebConfig :: !String -> !Int -> !Store -> !Int -> !Int -> !WebLimits -> !Bool -> !WebTimeouts -> !String -> !Bool -> !Bool -> WebConfig
+ Haskoin.Store.Web: WebConfig :: !String -> !Int -> !Store -> !Int -> !Int -> !WebLimits -> !WebTimeouts -> !String -> !Bool -> !Bool -> WebConfig

Files

app/Main.hs view
@@ -55,7 +55,6 @@     , configPeers        :: ![(String, Maybe Int)]     , configVersion      :: !Bool     , configDebug        :: !Bool-    , configReqLog       :: !Bool     , configMaxPending   :: !Int     , configWebLimits    :: !WebLimits     , configWebTimeouts  :: !WebTimeouts@@ -83,7 +82,6 @@                  , configPeers        = defPeers                  , configVersion      = False                  , configDebug        = defDebug-                 , configReqLog       = defReqLog                  , configMaxPending   = defMaxPending                  , configWebLimits    = defWebLimits                  , configWebTimeouts  = defWebTimeouts@@ -172,11 +170,6 @@     defEnv "DEBUG" False parseBool {-# NOINLINE defDebug #-} -defReqLog :: Bool-defReqLog = unsafePerformIO $-    defEnv "REQ_LOG" False parseBool-{-# NOINLINE defReqLog #-}- defNumTxId :: Bool defNumTxId = unsafePerformIO $     defEnv "NUMTXID" False parseBool@@ -324,10 +317,6 @@         flag (configDebug def) True $         long "debug"         <> help "Show debug messages"-    configReqLog <--        flag (configReqLog def) True $-        long "req-log"-        <> help "HTTP request logging"     maxLimitCount <-         option auto $         metavar "INT"@@ -513,7 +502,6 @@            , configDebug = deb            , configMaxPending = pend            , configWebLimits = limits-           , configReqLog = reqlog            , configWebTimeouts = tos            , configRedis = redis            , configRedisURL = redisurl@@ -562,7 +550,6 @@                     , webPort = port                     , webStore = st                     , webMaxLimits = limits-                    , webReqLog = reqlog                     , webTimeouts = tos                     , webMaxPending = pend                     , webVersion = version
haskoin-store.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           haskoin-store-version:        0.40.4+version:        0.40.5 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
@@ -933,23 +933,20 @@     when cool $ do     nodepool <- HashSet.fromList . map snd <$> lift getMempool     cachepool <- HashSet.fromList . map snd <$> cacheGetMempool-    txs <- mapM getit . HashSet.toList $-           mappend-                (HashSet.difference nodepool cachepool)-                (HashSet.difference cachepool nodepool)+    txs <- fmap catMaybes . mapM getit . HashSet.toList $+           HashSet.difference nodepool cachepool <>+           HashSet.difference cachepool nodepool     unless (null txs) $ do-        $(logDebugS) "Cache" "Importing mempool transactions"-        importMultiTxC (rights txs)+        $(logDebugS) "Cache" $+            "Importing mempool transactions: " <> cs (show (length txs))+        importMultiTxC txs     startCooldown   where     in_sync bb =         asks cacheChain >>= \ch ->         chainGetBest ch >>= \cb ->         return $ headerHash (nodeHeader cb) == bb-    getit th =-        lift (getTxData th) >>= \case-        Nothing -> return (Left th)-        Just tx -> return (Right tx)+    getit th = lift (getTxData th)  cacheGetMempool :: MonadLoggerIO m => CacheX m [(UnixTime, TxHash)] cacheGetMempool = runRedis redisGetMempool
src/Haskoin/Store/Web.hs view
@@ -81,7 +81,7 @@ import           Haskoin.Util import           Network.HTTP.Types            (Status (..), status400,                                                 status403, status404, status500,-                                                status503)+                                                status503, statusIsSuccessful) import           Network.Wai                   (Middleware, Request (..),                                                 responseStatus) import           Network.Wai.Handler.Warp      (defaultSettings, setHost,@@ -130,7 +130,6 @@     , webMaxDiff    :: !Int     , webMaxPending :: !Int     , webMaxLimits  :: !WebLimits-    , webReqLog     :: !Bool     , webTimeouts   :: !WebTimeouts     , webVersion    :: !String     , webNoMempool  :: !Bool@@ -202,14 +201,13 @@ runWeb :: (MonadUnliftIO m, MonadLoggerIO m) => WebConfig -> m () runWeb cfg@WebConfig{ webHost = host                     , webPort = port-                    , webReqLog = wl                     , webStore = store } = do     ticker <- newTVarIO HashMap.empty     withAsync (price (storeNetwork store) ticker) $ \_ -> do         reqLogger <- logIt         runner <- askRunInIO         S.scottyOptsT opts (runner . (`runReaderT` cfg)) $ do-            when wl $ S.middleware reqLogger+            S.middleware reqLogger             S.defaultHandler defHandler             handlePaths ticker             S.notFound $ S.raise ThingNotFound@@ -1477,9 +1475,10 @@             t2 <- getCurrentTime             let d = diffUTCTime t2 t1                 s = responseStatus res-            runner $-                $(logInfoS) "Web" $-                fmtReq req <> " [" <> fmtStatus s <> " / " <> fmtDiff d <> "]"+                msg = fmtReq req <> " [" <> fmtStatus s <> " / " <> fmtDiff d <> "]"+            if statusIsSuccessful s+                then runner $ $(logDebugS) "Web" msg+                else runner $ $(logErrorS) "Web" msg             respond res  fmtReq :: Request -> Text