Skip to content

Commit

Permalink
rewrite indexer service in the attempt to fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Feb 13, 2019
1 parent 545b33e commit 0d9107a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion state/txindex/indexer_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ func (is *IndexerService) OnStart() error {
select {
case msg := <-blockHeadersSub.Out():
header := msg.Data().(types.EventDataNewBlockHeader).Header
if header.NumTxs == 0 {
continue
}
batch := NewBatch(header.NumTxs)
for i := int64(0); i < header.NumTxs; i++ {
i := int64(0)
TXS_LOOP:
for {
select {
case msg2 := <-txsSub.Out():
txResult := msg2.Data().(types.EventDataTx).TxResult
Expand All @@ -57,6 +62,10 @@ func (is *IndexerService) OnStart() error {
"index", txResult.Index,
"err", err)
}
i++
if i == header.NumTxs {
break TXS_LOOP
}
case <-txsSub.Cancelled():
is.Logger.Error("Failed to index block. txsSub was cancelled. Did the Tendermint stop?",
"height", header.Height,
Expand Down

0 comments on commit 0d9107a

Please sign in to comment.