fix(pdf): attendre les indexations en vol avant de fermer le store (#38)#45
Merged
Conversation
pdfService.init() fermait le vector store inconditionnellement à la bascule de projet. Le PdfIndexer garde sa référence injectée au constructeur et écrit après le long await d'extraction isolée : le handle SQLite était fermé sous lui — « database connection is not open » au retour, échec bruyant d'une indexation par ailleurs saine. Les jobs d'indexation sont désormais suivis (Set de promesses) ; init() et close() les drainent avant de fermer, avec une attente bornée à 30 s pour qu'une extraction bloquée ne gèle pas la bascule (au-delà, l'indexation échoue avec une erreur visible, pas un crash). Closes #38 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Résumé
Basculer de projet pendant une indexation PDF fermait le store SQLite sous l'indexeur en vol :
pdfService.init()faitvectorStore.close()inconditionnellement, etPdfIndexer(référence injectée au constructeur) écrit après le longawaitd'extraction isolée → « database connection is not open ». Pas de corruption croisée (contrairement à #33), mais un échec bruyant d'une indexation saine.Correctif
indexPDFsont suivis dans unSetde promesses (inFlightIndexing).init()etclose()appellentdrainInFlightIndexing()avantvectorStore.close(): attente de la fin des jobs, bornée à 30 s pour qu'une extraction bloquée ne gèle pas la bascule de projet — au-delà, on ferme quand même et l'indexation échoue avec une erreur visible côté renderer.Vérification
npm run buildvert. Course inter-handlers IPC sur l'état singleton du main, non reproductible sous vitest node sans harnais Electron.Closes #38
🤖 Generated with Claude Code