Skip to content

Remove periodic reindexing#16

Merged
JesseHerrick merged 2 commits intomainfrom
remove-periodic-reindex
Apr 10, 2026
Merged

Remove periodic reindexing#16
JesseHerrick merged 2 commits intomainfrom
remove-periodic-reindex

Conversation

@JesseHerrick
Copy link
Copy Markdown
Collaborator

@JesseHerrick JesseHerrick commented Apr 10, 2026

Periodic reindexing was added as a fallback for when changes occur outside of the editor environment that could cause the index to get stale. However, this has a few drawbacks:

  • By indexing every 30 seconds, we force a full crawl of the filesystem. This is usually around 800ms and causes a spike in CPU (about 25% on my machine) every 30 seconds, not to mention unnecessary file IO.
  • If multiple editors are open, each running the LSP, we now have N spikes every 30 seconds, which is even worse.

After further testing, I found that the editor does a good job of tracking files across the project and issuing didChangeWatchedFiles events. So I believe we can safely get rid of this periodic reindexing without issue. We still do a full scan on startup to look for stale files, so we shouldn't have any edge cases from editors not being open.

If users start reporting stale index issues, we can revisit, but the potential solutions if the editor is missing changed files are either re-adding periodic indexing or tracking the files ourselves directly with fsevent, which work the editor should be handling. (Maybe there's another approach I'm missing though.)


Note

Medium Risk
Removes the 30s full-project reindex fallback, which reduces CPU/IO but may allow the index to become stale if editors fail to emit file-watcher events in some environments.

Overview
Removes the LSP server’s periodic 30-second backgroundReindex ticker and stops starting it during Initialize, relying on startup indexing plus event-driven updates (e.g., watched file changes and watchGitHead) to keep the index current.

This eliminates recurring full filesystem crawls to reduce CPU and IO overhead, especially when multiple editors are running.

Reviewed by Cursor Bugbot for commit 475fc67. Bugbot is set up for automated code reviews on this repo. Configure here.

@JesseHerrick JesseHerrick merged commit 3ed15a5 into main Apr 10, 2026
5 checks passed
@JesseHerrick JesseHerrick deleted the remove-periodic-reindex branch April 10, 2026 21:26
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.

1 participant