Skip to content

Commit

Permalink
create ES index pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
giantimi committed Jan 30, 2024
1 parent beb7381 commit 24781e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions exec/TXG.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24781e0

Please sign in to comment.