Browse Source

Join index & write duration measurement

chaintope/fix-wrong-block-pos
Roman Zeyde 5 years ago
parent
commit
4802cc9146
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 13
      src/index.rs

13
src/index.rs

@ -410,21 +410,18 @@ impl Index {
break;
}
let rows = batch.iter().flat_map(|block| {
let rows_iter = batch.iter().flat_map(|block| {
let blockhash = block.bitcoin_hash();
let height = *height_map
.get(&blockhash)
.unwrap_or_else(|| panic!("missing header for block {}", blockhash));
let timer = self.stats.start_timer("index");
let block_rows = index_block(block, height);
timer.observe_duration();
self.stats.update(block, height);
block_rows.chain(std::iter::once(last_indexed_block(&blockhash)))
self.stats.update(block, height); // TODO: update stats after the block is indexed
index_block(block, height).chain(std::iter::once(last_indexed_block(&blockhash)))
});
let timer = self.stats.start_timer("write");
store.write(rows);
let timer = self.stats.start_timer("index+write");
store.write(rows_iter);
timer.observe_duration();
}
let timer = self.stats.start_timer("flush");

Loading…
Cancel
Save