Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider: add MaxBatchSize limit #544

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions provider/reprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@
}
}

// MaxBatchSize limit how big each batch is.
// Some content routers like acceleratedDHTClient have sub linear scalling and
// bigger sizes are thus faster per elements however smaller batch sizes can
// limit memory usage spike.
func MaxBatchSize(n uint) Option {
return func(system *reprovider) error {
system.maxReprovideBatchSize = n
return nil
}

Check warning on line 194 in provider/reprovider.go

View check run for this annotation

Codecov / codecov/patch

provider/reprovider.go#L190-L194

Added lines #L190 - L194 were not covered by tests
}

// ThroughputReport will fire the callback synchronously once at least limit
// multihashes have been advertised, it will then wait until a new set of at least
// limit multihashes has been advertised.
Expand Down
Loading