Repository navigation
fix(maintenance): cambios con su historial en una transacción y altas simultáneas - #12
Merged
bpstack merged 2 commits intoOct 12, 2026
Conversation
- maintenance-repository.ts: create, update, updateStatus, updatePriority, addResolutionNotes, delete and restore run their write and history rows inside withTransaction; every query goes through dbx(). - atomic-history.test.ts: each of the seven rolls back when the history insert fails, and writes both rows on one connection when it succeeds. Why: the two writes were separate queries, so a failed history insert left the change saved without a trace and answered 500, inviting a retry that applied it twice. Checked against the local database: the seven operations answer 200 and leave their eight history rows.
- Retry a new report with the next number of the day when another one took its id (up to 5 attempts, each in its own transaction). - Count a report's photos again under a lock on the report when saving one; an upload that loses the race is removed from Cloudinary and answers 400. - Document both rules, the 999 reports a day left as is, and that changes and their history now share a transaction. Two reports created at once read the same last id and the second one died with a 500 on the duplicate key. Photos were counted before the upload to Cloudinary, so uploads in parallel went past the limit of 5.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
Cambios
Por qué
Un fallo a mitad dejaba el cambio sin historial, y altas o fotos simultáneas daban 500 o pasaban del límite.