Repository navigation
Conversation
…t uploads After each document reaches a terminal state (COMPLETED or FAILED), check whether all other documents in the same topic are also terminal before triggering generateTopicDescription and generateClassDescription. A distributed JobLock ensures exactly one API instance runs generation even when multiple completions race. Previously getSummarizationFuture triggered both description generation calls on every completing document, causing N parallel writes to the same Neo4j node. processFailedResult never triggered description regeneration at all. Changes: - DocumentRepository: add areAllDocumentsInTopicTerminal and areAllDocumentsInClassTerminal queries using Cypher all() predicate - ConvertingResultConsumer: inject JobLockRepository; extract triggerDescriptionGenerationIfAllTerminal which checks terminal state and acquires a per-topic/per-class JobLock before generating; call it asynchronously from both processSuccessfulResult and processFailedResult after persisting terminal status; remove now-unused topicRepository and classRepository fields Implements #108 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 of 8 tasks
nilskntl
deleted the
108-fix-race-condition-in-topicclass-description-generation-when-multiple-documents-upload-concurrently
branch
March 21, 2026 00:44
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.
Summary
areAllDocumentsInTopicTerminalandareAllDocumentsInClassTerminalqueries toDocumentRepositoryusing Cypherall()predicate — returnstrueonly when every document in scope has statusCOMPLETEDorFAILEDtriggerDescriptionGenerationIfAllTerminal(topicId, classId)inConvertingResultConsumer: checks the terminal-state condition, then acquires a per-topic/per-classJobLock(atomic Neo4j MERGE) before callinggenerateTopicDescription/generateClassDescription, ensuring exactly one API instance runs each generation even when multiple document completions raceprocessSuccessfulResultandprocessFailedResultafter the document's terminal status is persisted, so the consumer loop is not blockedgenerateTopicDescription/generateClassDescriptioncalls fromgetSummarizationFuture(which fired once per completing document)topicRepositoryandclassRepositoryfieldsIssue
Closes #108
Generated with Claude Code