fix: Fix race condition in parallel issue creation (bd-89)
Use IMMEDIATE transactions with dedicated connections to fix race condition where multiple processes creating issues concurrently caused "UNIQUE constraint failed: issues.id" errors. Key changes: - Use BEGIN IMMEDIATE to acquire RESERVED lock early - Use dedicated connection (sql.Conn) for transaction to ensure all operations happen on same connection - Increase busy_timeout from 10s to 30s for better parallel write handling - Use context.Background() for ROLLBACK to ensure cleanup even if ctx cancelled Added regression test TestParallelIssueCreation that creates 20 issues in parallel and verifies no ID collisions occur. Fixes #6 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user