Repository navigation
Conversation
When an app is first watched, its listeners (regenerating the user-facing code, updating .gitignore) run inside Watch, so `encore run` waits for a second parse of the app before it starts serving. Nothing depends on them finishing, so run them in a goroutine that recovers and logs panics. The listeners cache the app's metadata after parsing it. A reload that lands while they are still running can have its metadata replaced by the older parse until the next parse corrects it. The "server running" banner no longer waits for that second parse.
This branch has not been deployed
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.
encore runwaits for the app listeners (regenerating the user-facing code, updating .gitignore) to finish before it starts serving. They re-parse the app, which is the second parse of a run, and nothing depends on it finishing, so the "server running" banner no longer needs to wait for it.notifyAppListenersfromInstance.Watchin a goroutine that recovers and logs panics.Watchreturns while a listener is still blocked.Why this should not change existing behaviour
Watchreturns only a subscription ID, and the run builds and starts the app from its own parse and overlays, not from the files the listeners write (the user-facing wrappers and .gitignore entries are for editors and tooling).regenerateUserCodefrom a debounced goroutine on every change, and the same function is exposed through theGenWrappersRPC. This change adds one more caller of that path and does not introduce concurrent use of it.Watch.Watchhas one caller, the run's file watcher, so there is no other code relying on the old ordering.Known trade-off: the listeners cache the app's metadata after parsing it. A reload that lands while they are still running can have its metadata replaced by the older parse until the next parse corrects it. The cache is read by the dashboard and MCP tools, not by the build. The window is one parse long.
Testing
go test -race ./cli/daemon/apps/...go vet,golangci-lint --new-from-rev=origin/main(0 issues) and a Windows build.Need help on this PR? Tag
@codesmith-botwith what you need.