Repository navigation
fix(native): read git every second and when a card is selected - #921
Merged
Merged
Conversation
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.
What
The native window re-read each card's checkout every 3 seconds, and only then. A commit, checkout or edit made outside a turn (in a terminal, say) took up to 3s to show on the card and the footer. The pull request badge waited for that tick before asking
gh, so after a commit it lagged up to about 3.6s. Selecting a card showed whatever the last tick had found.The backend was not the bottleneck. Measured against a running 0.78.0 backend,
project.Diffanswers in 3-35ms per checkout andproject.BaseStatusin 1-2ms. A full tick over six open checkouts stays under 70ms.How
gitPollgoes from 3s to 1s (native/cmd/lich-native/model.go).ghis asked no more often than before: the pull request is looked up again only when the branch or head moves, or onprRecheck.setActive, the one path every card switch goes through (click, hotkey, layout), reads the selected card's checkout at once withrefreshPath.Tests
TestSelectingACardReadsItsGitWithoutATick: selecting a card reads the new head without a tick. It fails without the fix.fakeUnreadincardstate_test.gonow answers the git reads, becausesetActivemakes them (the contract changed). No assertion changed.Local gate from
native/:gofmt -l .clean,go vet ./...clean,go test ./...green. The selection, unread and session-touched tests also ran green at-count=50. Nothing outsidenative/changed besidesCHANGELOG.md, so the backend suite was not run. No OS seam touched.CHANGELOG.md[Unreleased]› Fixed has an entry. Provider parity: this is window-side git polling, the same for every provider.