fix: update last_import_time when hash matches but mtime is newer
When JSONL mtime changes without content change (e.g., git pull, touch), the staleness check would repeatedly trigger but auto-import would skip due to hash match, creating an infinite loop of "Database out of sync" errors. Now we update last_import_time even when skipping import due to hash match, breaking the staleness loop. Fixes #378 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,12 @@ func AutoImportIfNewer(ctx context.Context, store storage.Storage, dbPath string
|
||||
|
||||
if currentHash == lastHash {
|
||||
notify.Debugf("auto-import skipped, JSONL unchanged (hash match)")
|
||||
// Update last_import_time to prevent repeated staleness warnings
|
||||
// This handles the case where mtime changed but content didn't (e.g., git pull, touch)
|
||||
importTime := time.Now().Format(time.RFC3339)
|
||||
if err := store.SetMetadata(ctx, "last_import_time", importTime); err != nil {
|
||||
notify.Warnf("failed to update last_import_time: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user