Make the auto-save mutation threshold configurable (--auto-save-mutations) - #90
Merged
Shengyu Fu (shengyfu) merged 1 commit intoAug 17, 2026
Conversation
`tgrep serve` saves the in-memory index to disk after a fixed 5000 accumulated mutations. Under heavy filesystem churn (e.g. a large sync) this can fire frequent full-index saves, each of which briefly pauses indexing. Expose the threshold as `--auto-save-mutations <N>` (default 5000) so it can be raised to trade save frequency for a larger unsaved-work window on crash.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes tgrep serve’s auto-save trigger threshold configurable via a new --auto-save-mutations <N> flag (defaulting to the existing behavior of 5000), allowing operators to reduce frequent full-index saves during high filesystem churn.
Changes:
- Added
--auto-save-mutations <N>to theservecommand CLI options (validated asu32 >= 1). - Threaded the configured threshold through
serve::runintoServerState. - Updated the auto-save loop to use
state.auto_save_mutationsinstead of the fixed constant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tgrep-cli/src/serve.rs |
Plumbs the configurable threshold into ServerState and uses it in the auto-save trigger condition. |
tgrep-cli/src/main.rs |
Adds the --auto-save-mutations CLI flag for tgrep serve and passes it to serve::run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@microsoft-github-policy-service agree company="Epic Games" |
Member
|
Dan Elksnitis (@dpelksnitis), thanks for your contribution! |
Shengyu Fu (shengyfu)
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tgrep serveauto-saves the in-memory index to disk once a fixed 5000 accumulated mutations pile up (AUTO_SAVE_MUTATIONS). Under sustained filesystem churn — a large VCS sync, a big build, mass file operations — that threshold is crossed repeatedly, firing frequent full-index saves that each briefly pause indexing.Change
Expose the threshold as
--auto-save-mutations <N>onserve(default unchanged at 5000), threaded throughServerStateto the auto-save loop. Raising it reduces save frequency during heavy churn, trading a larger unsaved-work window (recovered by the stale check on next start) for fewer mid-activity pauses.cargo fmt --all --check,cargo clippy --all-targets, andcargo testpass.