Only flush JSONL on import if there were actual changes
Avoid unnecessary I/O when import has no updates
This commit is contained in:
@@ -178,7 +178,10 @@ Behavior:
|
|||||||
|
|
||||||
// Flush immediately after import (no debounce) to ensure daemon sees changes
|
// Flush immediately after import (no debounce) to ensure daemon sees changes
|
||||||
// Without this, daemon FileWatcher won't detect the import for up to 30s
|
// Without this, daemon FileWatcher won't detect the import for up to 30s
|
||||||
flushToJSONL()
|
// Only flush if there were actual changes to avoid unnecessary I/O
|
||||||
|
if result.Created > 0 || result.Updated > 0 || len(result.IDMapping) > 0 {
|
||||||
|
flushToJSONL()
|
||||||
|
}
|
||||||
|
|
||||||
// Print summary
|
// Print summary
|
||||||
fmt.Fprintf(os.Stderr, "Import complete: %d created, %d updated", result.Created, result.Updated)
|
fmt.Fprintf(os.Stderr, "Import complete: %d created, %d updated", result.Created, result.Updated)
|
||||||
|
|||||||
Reference in New Issue
Block a user