Skip to content

Conversation

@mkysel
Copy link
Collaborator

@mkysel mkysel commented Jul 11, 2025

Make prune batch size configurable by adding BatchSize field to PruneConfig struct and updating DeleteExpiredEnvelopesBatch function to accept parameterized batch size

Adds a configurable BatchSize field to the PruneConfig struct with a default value of 10000, accessible via --batch-size command line flag and XMTPD_PRUNE_BATCH_SIZE environment variable. The changes include:

  • Modifies the DeleteExpiredEnvelopesBatch function in pkg/db/queries/prune.sql.go to accept a batchSize parameter instead of using a hardcoded limit of 1000
  • Updates the SQL query in pkg/db/sqlc/prune.sql to use parameterized @batch_size instead of hardcoded LIMIT 1000
  • Adds validation in NewPruneExecutor function in pkg/prune/prune.go to ensure BatchSize is greater than 0
  • Updates the prune executor to pass the configured BatchSize to the database query

📍Where to Start

Start with the PruneConfig struct in pkg/config/pruneOptions.go to understand the new configuration field, then review the NewPruneExecutor function in pkg/prune/prune.go to see how the configuration is validated and used.

Changes since #964 opened

  • Modified test configuration to set fixed batch size [023bf46]

Macroscope summarized 023bf46.

@mkysel mkysel requested a review from a team as a code owner July 11, 2025 16:38
@graphite-app
Copy link

graphite-app bot commented Jul 11, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@mkysel mkysel enabled auto-merge (squash) July 14, 2025 16:24
@mkysel mkysel merged commit 21f49f0 into main Jul 14, 2025
8 of 9 checks passed
@mkysel mkysel deleted the mkysel/configurable-prune-size branch July 14, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants