Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #714 +/- ##
==========================================
+ Coverage 94.48% 94.73% +0.25%
==========================================
Files 59 59
Lines 3246 3250 +4
==========================================
+ Hits 3067 3079 +12
+ Misses 179 171 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
MateoLostanlen
left a comment
There was a problem hiding this comment.
One commit per request is the right move and the rollback tests show it works. One blocker, one small nit.
Blocker: two requests for the same pose can block each other
With commit=False, the lock on a sequence row is now kept until the end of create_detection. If one frame touches sequence A then B, and another frame of the same pose touches B then A at the same time, Postgres kills one of them with deadlock detected. That request fails with a 500 and its image is already on S3. Rare, but new with this PR: the old code released the lock right after each update.
Easy fix: lock the pose for the whole transaction before the first write, e.g. SELECT pg_advisory_xact_lock(:pose_id). Requests for the same pose then wait for each other, and the lock goes away on commit or rollback.
Nit: bump_max_conf and enqueue_validation are now always called with commit=False. The default branch is the line Codecov flags. The flag can go.
Everything else looks good: each path ends with one commit or rolls back when the session closes, skipping refresh is safe with expire_on_commit=False, the bulk UPDATE in delete_sequence does the same thing as before, and I found no lock problem with the validation worker.
Prevent partial detection and alert edits by deferring workflow commits. Reuse shared save logic and unlink detections in bulk.
Local PostgreSQL; three fresh workers/revision, one warmup then three serial requests each. Latency is request p50; RSS is median worker VmHWM including startup. CRUD memory use is essentially unchanged.
Media uploads are excluded from timing and remain outside the DB transaction. Rollback tests, Ruff and Ty pass.