Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 37a08ea

Browse files
committed
Update numWorkers
1 parent fc57c28 commit 37a08ea

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

ss/pebbledb/db.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const (
4242
ImportCommitBatchSize = 10000
4343
PruneCommitBatchSize = 50
4444
DeleteCommitBatchSize = 50
45+
46+
// Number of workers to use for hash computation
47+
HashComputationWorkers = 10
4548
)
4649

4750
var (
@@ -436,12 +439,19 @@ func (db *Database) computeHashForRange(beginBlock, endBlock int64) error {
436439
return nil
437440
}
438441

439-
numOfWorkers := int(endBlock/chunkSize) + 1
442+
// Use constant number of workers
443+
numOfWorkers := HashComputationWorkers
444+
445+
// Calculate blocks per worker
446+
blocksPerWorker := chunkSize / int64(numOfWorkers)
447+
if blocksPerWorker < 1 {
448+
blocksPerWorker = 1
449+
}
440450

441451
for _, moduleName := range util.Modules {
442452
dataCh := make(chan types.RawSnapshotNode, 10_000)
443453

444-
hashCalculator := util.NewXorHashCalculator(chunkSize, numOfWorkers, dataCh)
454+
hashCalculator := util.NewXorHashCalculator(blocksPerWorker, numOfWorkers, dataCh)
445455

446456
go func(mod string) {
447457
defer close(dataCh)

0 commit comments

Comments
 (0)