Skip to content

Commit

Permalink
deduplicate indices on insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Nov 16, 2023
1 parent 4002bdc commit b283b4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
for (partial_key, indices) in index_updates {
let last_shard = self.take_shard::<T>(sharded_key_factory(partial_key, u64::MAX))?;
// chunk indices and insert them in shards of N size.
let indices = last_shard.iter().chain(indices.iter());
let indices = last_shard.iter().chain(indices.iter()).dedup();
let chunks = indices
.chunks(sharded_key::NUM_OF_INDICES_IN_SHARD)
.into_iter()
Expand Down

0 comments on commit b283b4e

Please sign in to comment.