Implement timestamp tracking and staleness detection (bd-159, bd-160)
- bd-159: Track last_import_time in metadata after auto-import - bd-160: Add staleness check to daemon before serving requests - Detects when JSONL mtime > last import time - Currently logs warning (needs bd-166 for actual import trigger) - Add lastImportTime field to RPC Server struct with getter/setter - Add checkAndAutoImportIfStale() method to detect stale JSONL This is part of bd-158 epic to fix daemon showing stale data after git pull. Amp-Thread-ID: https://ampcode.com/threads/T-b554e049-aff8-4a24-8bf3-3305483b7f5a Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -1099,6 +1099,12 @@ func autoImportIfNewer() {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to update last_import_hash after import: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "This may cause auto-import to retry the same import on next operation.\n")
|
||||
}
|
||||
|
||||
// Store import timestamp (bd-159: for staleness detection)
|
||||
importTime := time.Now().Format(time.RFC3339)
|
||||
if err := store.SetMetadata(ctx, "last_import_time", importTime); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to update last_import_time after import: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
// checkVersionMismatch checks if the binary version matches the database version
|
||||
|
||||
Reference in New Issue
Block a user