bugfix meta-fuse
This commit is contained in:
@@ -150,6 +150,50 @@ export class VirtualFileSystem {
|
||||
logger.info('VirtualFileSystem stopped');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the VFS to empty state
|
||||
* Called when meta-sort triggers a fresh scan
|
||||
* The VFS will be rebuilt incrementally as files are processed via pub/sub
|
||||
*
|
||||
* IMPORTANT: This stops the periodic refresh timer to prevent repopulating
|
||||
* from Redis (which still has old data). The VFS will only update via
|
||||
* incremental pub/sub events until the next full refresh is triggered.
|
||||
*/
|
||||
reset(): void {
|
||||
logger.info('Resetting VFS for fresh scan...');
|
||||
|
||||
// Stop periodic refresh to prevent repopulating from stale Redis data
|
||||
if (this.refreshTimer) {
|
||||
clearInterval(this.refreshTimer);
|
||||
this.refreshTimer = null;
|
||||
logger.info('Periodic refresh timer stopped - VFS will update via pub/sub only');
|
||||
}
|
||||
|
||||
this.initRoot();
|
||||
this.lastRefresh = null;
|
||||
logger.info('VFS reset complete - awaiting new file updates from meta-sort');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume periodic refresh from Redis
|
||||
* Called after a scan is complete to re-enable auto-refresh
|
||||
*/
|
||||
resumePeriodicRefresh(): void {
|
||||
if (this.refreshTimer) {
|
||||
logger.debug('Periodic refresh already running');
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info('Resuming periodic refresh from Redis');
|
||||
this.refreshTimer = setInterval(async () => {
|
||||
try {
|
||||
await this.refresh();
|
||||
} catch (error) {
|
||||
logger.error('Failed to refresh VFS:', error);
|
||||
}
|
||||
}, this.config.refreshInterval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the VFS from Redis
|
||||
* Uses template-based rules if configured, otherwise falls back to MetaDataToFolderStruct
|
||||
|
||||
Reference in New Issue
Block a user