mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
fix: correct column name in memory cleanup from last_accessed to accessed_at
- Fix 'no such column: last_accessed' error in maintenance tasks - Add table existence check before memory cleanup - Add try-catch for memory cleanup operations - Improve error handling with warning messages instead of failures
This commit is contained in:
1 parent
a278bdb9fe
commit
f10c93a48e
2 files changed
+23
-9
No files matched your search
Binary file not shown.
@@ -583,16 +583,30 @@ export async function performMaintenance(dbPath, options = {}) {
|
||||
|
||||
// Clean up old memory entries
|
||||
if (options.cleanMemory) {
|
||||
spinner.text = 'Cleaning old memory entries...';
|
||||
const cutoffDate = new Date();
|
||||
cutoffDate.setDate(cutoffDate.getDate() - (options.memoryRetentionDays || 30));
|
||||
// Check if collective_memory table exists
|
||||
const hasMemoryTable = db.prepare(`
|
||||
SELECT name FROM sqlite_master
|
||||
WHERE type='table' AND name='collective_memory'
|
||||
`).get();
|
||||
|
||||
const result = db.prepare(`
|
||||
DELETE FROM collective_memory
|
||||
WHERE last_accessed < ? AND access_count < 5
|
||||
`).run(cutoffDate.toISOString());
|
||||
|
||||
console.log(chalk.green(`✓ Removed ${result.changes} old memory entries`));
|
||||
if (hasMemoryTable) {
|
||||
spinner.text = 'Cleaning old memory entries...';
|
||||
const cutoffDate = new Date();
|
||||
cutoffDate.setDate(cutoffDate.getDate() - (options.memoryRetentionDays || 30));
|
||||
|
||||
try {
|
||||
const result = db.prepare(`
|
||||
DELETE FROM collective_memory
|
||||
WHERE accessed_at < ? AND access_count < 5
|
||||
`).run(cutoffDate.toISOString());
|
||||
|
||||
console.log(chalk.green(`✓ Removed ${result.changes} old memory entries`));
|
||||
} catch (error) {
|
||||
console.warn(chalk.yellow(`⚠ Could not clean memory entries: ${error.message}`));
|
||||
}
|
||||
} else {
|
||||
console.log(chalk.yellow('⚠ collective_memory table not found, skipping memory cleanup'));
|
||||
}
|
||||
}
|
||||
|
||||
// Archive completed tasks
|
||||
|
||||
Reference in new issue
Block a user