Skip to content

Commit

Permalink
cometindex: use relevant events as count for batching events
Browse files Browse the repository at this point in the history
  • Loading branch information
cronokirby committed Sep 16, 2024
1 parent 71e84cc commit 21aca87
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/util/cometindex/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ impl Indexer {

relevant_events += 1;

// Otherwise we have something to process. Make a dbtx
for index in indexes {
if index.is_relevant(&event.as_ref().kind) {
tracing::debug!(?event, ?index, "relevant to index");
Expand All @@ -190,7 +189,7 @@ impl Indexer {
update_watermark(&mut dbtx, event.local_rowid).await?;
// Only commit in batches of <= 1000 events, for about a 5x performance increase when
// catching up.
if scanned_events % 1000 == 0 {
if relevant_events % 1000 == 0 {
dbtx.commit().await?;
dbtx = dst_db.begin().await?;
}
Expand Down

0 comments on commit 21aca87

Please sign in to comment.