This commit is contained in:
Pierre
2026-02-07 12:50:21 +01:00
parent 7886870046
commit 0087a353c2
2 changed files with 21 additions and 3 deletions
+1 -3
View File
@@ -64,9 +64,7 @@ async function handleStreamMessage(message: StreamMessage, vfs: VirtualFileSyste
case 'reset': { case 'reset': {
const reset: ResetPayload = JSON.parse(message.payload); const reset: ResetPayload = JSON.parse(message.payload);
logger.info(`Processing reset event: ${reset.action}`); logger.info(`Processing reset event: ${reset.action}`);
await vfs.resetAndReload();
vfs.reset();
logger.info('VFS reset complete, awaiting new file updates');
break; break;
} }
@@ -148,6 +148,26 @@ export class VirtualFileSystem {
logger.info('VFS reset complete - awaiting new file updates from meta-sort'); logger.info('VFS reset complete - awaiting new file updates from meta-sort');
} }
/**
* Reset the VFS and immediately reload from Redis
* Called when meta-sort triggers a fresh scan (reset event)
* Unlike reset(), this method immediately repopulates from Redis keys.
*/
async resetAndReload(): Promise<void> {
const startTime = Date.now();
logger.info('Resetting VFS and reloading from Redis...');
// Clear the VFS
this.initRoot();
this.lastRefresh = null;
// Immediately reload from Redis keys
await this.refresh();
const elapsed = Date.now() - startTime;
logger.info(`VFS reset and reload complete: ${this.cachedStats.fileCount} files in ${elapsed}ms`);
}
/** /**
* Refresh the VFS from Redis * Refresh the VFS from Redis
* Called once on startup for initial bootstrap. * Called once on startup for initial bootstrap.