Optimize database transactions for checksum processing to eliminate lock contention - #27
Merged
MarkProminic merged 1 commit intoSep 25, 2025
Conversation
- Wrap both File.update() calls in single sequelize.transaction() - Eliminates fragmented transactions that cause database lock contention - Reduces lock windows from 2 separate transactions to 1 per checksum - Maintains existing SSE functionality and error handling - Addresses 'database is locked' errors during concurrent processing Co-Authored-By: mark.gilbert@prominic.net <mark.gilbert@prominic.net>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
MarkProminic
deleted the
devin/1758791844-optimize-database-transactions
branch
September 25, 2025 10:40
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.
Optimize database transactions for checksum processing to eliminate lock contention
Summary
Fixes "database is locked" errors during concurrent checksum processing by consolidating fragmented database transactions. Previously, each checksum operation created 2 separate transactions (status update → checksum calculation → final update), causing lock contention when 5 concurrent operations competed with monitoring queries. Now both database updates are wrapped in a single
sequelize.transaction(), reducing lock windows by 50%.Key changes:
File.update()calls in single transaction inprocessChecksumWithTimeout()Review & Testing Checklist for Human
Notes
This addresses the core performance issue identified during file watcher optimization analysis. The transaction scope now includes checksum calculation (file I/O), which could hold database locks slightly longer, but eliminates the much more problematic fragmented transaction pattern.
Link to Devin run: https://app.devin.ai/sessions/a84f1763f38f47c7a556fc6af605272c
Requested by: @MarkProminic