Only flush JSONL on import if there were actual changes

Avoid unnecessary I/O when import has no updates
This commit is contained in:
Steve Yegge
2025-11-02 15:50:35 -08:00
parent 8ba063a4f2
commit 7e5b382161

View File

@@ -178,7 +178,10 @@ Behavior:
// Flush immediately after import (no debounce) to ensure daemon sees changes
// 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
fmt.Fprintf(os.Stderr, "Import complete: %d created, %d updated", result.Created, result.Updated)