fix: prevent infinite loop in pagination when storage returns phantom items
- Fix FileSystemStorage counting non-existent files in totalCount - Add safety check in BaseStorage to prevent hasMore:true with empty items - Ensure pagination terminates correctly even with corrupted storage state
This commit is contained in:
parent
25785c7d85
commit
4ba22f95bc
10 changed files with 340 additions and 22 deletions
|
|
@ -22,6 +22,7 @@ import { NaturalLanguageProcessor } from './neural/naturalLanguageProcessor.js'
|
|||
import { TripleIntelligenceSystem } from './triple/TripleIntelligenceSystem.js'
|
||||
import { MetadataIndexManager } from './utils/metadataIndex.js'
|
||||
import { GraphAdjacencyIndex } from './graph/graphAdjacencyIndex.js'
|
||||
import { configureLogger, LogLevel } from './utils/logger.js'
|
||||
import {
|
||||
Entity,
|
||||
Relation,
|
||||
|
|
@ -94,15 +95,24 @@ export class Brainy<T = any> {
|
|||
storage: { ...this.config.storage, ...configOverrides.storage },
|
||||
model: { ...this.config.model, ...configOverrides.model },
|
||||
index: { ...this.config.index, ...configOverrides.index },
|
||||
augmentations: { ...this.config.augmentations, ...configOverrides.augmentations }
|
||||
augmentations: { ...this.config.augmentations, ...configOverrides.augmentations },
|
||||
verbose: configOverrides.verbose ?? this.config.verbose,
|
||||
silent: configOverrides.silent ?? this.config.silent
|
||||
}
|
||||
|
||||
|
||||
// Set dimensions if provided
|
||||
if (dimensions) {
|
||||
this.dimensions = dimensions
|
||||
}
|
||||
}
|
||||
|
||||
// Configure logging based on config options
|
||||
if (this.config.silent) {
|
||||
configureLogger({ level: -1 as LogLevel }) // Suppress all logs
|
||||
} else if (this.config.verbose) {
|
||||
configureLogger({ level: LogLevel.DEBUG }) // Enable verbose logging
|
||||
}
|
||||
|
||||
try {
|
||||
// Setup and initialize storage
|
||||
this.storage = await this.setupStorage()
|
||||
|
|
@ -1487,7 +1497,9 @@ export class Brainy<T = any> {
|
|||
warmup: config?.warmup ?? false,
|
||||
realtime: config?.realtime ?? false,
|
||||
multiTenancy: config?.multiTenancy ?? false,
|
||||
telemetry: config?.telemetry ?? false
|
||||
telemetry: config?.telemetry ?? false,
|
||||
verbose: config?.verbose ?? false,
|
||||
silent: config?.silent ?? false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue