fix(desktop): a slow database migration no longer counts as a failed start - #235
Merged
Conversation
…start The desktop kills a backend that has not answered its readiness probe within 60 seconds of a first launch. The SQLite driver is synchronous, so a backend inside a long migration statement cannot answer anything, and it looked exactly like a hung process: the run was killed, the migration transaction rolled back, and "Try Again" repeated the same work forever. That is how nightly .275 bricked startup on large databases (#234). The server now logs each migration as it starts and finishes, with its duration, using two message prefixes shared through contracts. At the readiness deadline the desktop reads its captured backend output: if a "Running migration" line has no matching "Finished migration" line, it keeps probing without a deadline and shows a small info box saying which database update is running, with Keep Waiting and Quit. The box closes on its own when the backend answers or the run ends. Without an unfinished migration the 60-second kill is unchanged. Message boxes now receive the fiber's abort signal, so an interrupted dialog closes instead of lingering.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
The desktop treats a backend that has not answered within 60 seconds of a first launch as dead and kills it. But the SQLite driver is synchronous: while a long migration statement runs, the backend cannot answer HTTP, log, or heartbeat, so healthy work looked identical to a hang. The kill rolled the migration back and Try Again started it over. That is how nightly .275 left the app stuck at "Threadlines couldn't start" on large databases (#234 fixes that migration; this PR fixes the next one).
Two changes:
The two log prefixes live in contracts so the writer and the reader cannot drift apart. Message boxes now receive the fiber's abort signal through the shared Electron dialog wrapper, so any dialog closed by interruption goes away instead of lingering.
Tests: one new desktop test covers the keep-waiting path end to end (deadline passes mid-migration, no kill, notice shown, backend answers, notice closed, window opens). The existing readiness-timeout test now includes a finished migration in the output, proving a completed migration does not buy a hung backend extra time.