bug fix on file dispaly, document update

This commit is contained in:
Pierre
2026-02-21 18:48:14 +01:00
parent d83c9021d6
commit c2420aa1fa
10 changed files with 1818 additions and 523 deletions
+5 -13
View File
@@ -151,6 +151,10 @@ async function main(): Promise<void> {
filesPath: config.filesPath,
});
// Wire up StateBuilder to VFS for refresh operations
// This enables vfs.refresh() to replay the event stream
vfs.setStreamingStateBuilder(stateBuilder);
// Bootstrap: Replay meta:events stream from position 0
// This rebuilds state from all historical events
logger.info(`Replaying ${EVENTS_STREAM} stream from position 0 (streaming bootstrap)...`);
@@ -166,21 +170,9 @@ async function main(): Promise<void> {
);
const bootstrapTime = Date.now() - bootstrapStart;
let stats = vfs.getStats();
const stats = vfs.getStats();
logger.info(`Streaming bootstrap complete: ${stats.fileCount} files in ${bootstrapTime}ms`);
// Fallback: If stream was empty but Redis has files, bootstrap from Redis keys
// This handles the case where meta-core restarted and cleared the stream
if (stats.fileCount === 0) {
const indexCount = await redisClient.getIndexCount();
if (indexCount > 0) {
logger.info(`Stream was empty but Redis has ${indexCount} files - bootstrapping from Redis keys...`);
await vfs.refresh();
stats = vfs.getStats();
logger.info(`Redis key bootstrap complete: ${stats.fileCount} files`);
}
}
// Start live stream consumer from where replay left off
logger.info(`Starting live stream consumer from ${lastId}...`);
redisClient.startSimpleStreamConsumer(