chore(release): 2.14.1
- Fix verb retrieval in FileSystemStorage adapter - Add safety warnings for large datasets - Document performance considerations for count methods
This commit is contained in:
parent
fa6c22ce4b
commit
04549aec2d
4 changed files with 14 additions and 3 deletions
|
|
@ -997,6 +997,8 @@ export class FileSystemStorage extends BaseStorage {
|
|||
|
||||
try {
|
||||
// List all verb files in the verbs directory
|
||||
// Note: For very large directories (millions of files), this could be memory-intensive
|
||||
// Future optimization: Use fs.opendir() for streaming directory reads
|
||||
const files = await fs.promises.readdir(this.verbsDir)
|
||||
const verbFiles = files.filter((f: string) => f.endsWith('.json'))
|
||||
|
||||
|
|
@ -1008,6 +1010,11 @@ export class FileSystemStorage extends BaseStorage {
|
|||
const endIndex = Math.min(startIndex + limit, totalCount)
|
||||
const hasMore = endIndex < totalCount
|
||||
|
||||
// Safety check for large datasets
|
||||
if (totalCount > 100000) {
|
||||
console.warn(`Large verb dataset detected (${totalCount} verbs). Consider using a database for better performance.`)
|
||||
}
|
||||
|
||||
// Load the requested page of verbs
|
||||
const verbs: GraphVerb[] = []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue