Fix bd-306: Use PID suffix for temp files to avoid concurrent collisions
- Change temp filename from issues.jsonl.tmp to issues.jsonl.tmp.<pid> - Prevents race conditions when multiple bd commands run concurrently - Added issues bd-300 through bd-306 (git-based restoration epic)
This commit is contained in:
@@ -634,7 +634,8 @@ func flushToJSONL() {
|
||||
})
|
||||
|
||||
// Write to temp file first, then rename (atomic)
|
||||
tempPath := jsonlPath + ".tmp"
|
||||
// Use PID in filename to avoid collisions between concurrent bd commands (bd-306)
|
||||
tempPath := fmt.Sprintf("%s.tmp.%d", jsonlPath, os.Getpid())
|
||||
f, err := os.Create(tempPath)
|
||||
if err != nil {
|
||||
recordFailure(fmt.Errorf("failed to create temp file: %w", err))
|
||||
|
||||
Reference in New Issue
Block a user