bug fix on file dispaly, document update
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user