diff --git a/exec/TXG.hs b/exec/TXG.hs index 800f10c..8521dea 100644 --- a/exec/TXG.hs +++ b/exec/TXG.hs @@ -508,6 +508,11 @@ mkElasticSearchRequest esConf version start end rks = do , "timestamp" .= now ] +esPutReq :: MonadIO m => MonadThrow m => Manager -> ElasticSearchConfig -> ChainwebVersion -> m () +esPutReq mgr esConf version = do + esReq <- liftIO $ createElasticsearchIndex esConf version + liftIO $ httpJson mgr esReq + createElasticsearchIndex :: MonadIO m => MonadThrow m => ElasticSearchConfig -> ChainwebVersion -> m HTTP.Request createElasticsearchIndex esConf version = do let indexName :: String @@ -716,8 +721,7 @@ realTransactions config (ChainwebHost h _p2p service) tcut tv distribution = do -- Set up values for running the effect stack. gen <- liftIO createSystemRandom -- create elasticsearch index if ElasticSearchConfig is set - forM_ (elasticSearchConfig config) $ \esConfig -> do - createElasticsearchIndex esConfig (nodeVersion config) + forM_ (elasticSearchConfig config) $ \esConfig -> esPutReq (confManager cfg) esConfig (nodeVersion config) let act = loop (confirmationDepth config) tcut (liftIO randomEnum >>= generateTransactions False (verbose config)) env = set (field @"confKeysets") accountMap cfg stt = TXGState gen tv chains