brainy/src/storage
David Snelling d8ae76ba99 feat(storage): fix critical socket exhaustion during metadata reading
CRITICAL ISSUE FIXED: Service initialization was failing due to socket exhaustion
when reading metadata for 1400+ items during index rebuild

Changes:
- Add batch metadata reading to prevent 2000+ concurrent requests
- Implement strict concurrency control (3 max concurrent requests)
- Add proper yielding between batches to prevent event loop blocking
- Reduce batch sizes during initialization (50 → 25 items per batch)
- Add getMetadataBatch() and getVerbMetadataBatch() methods to S3 storage
- Update StorageAdapter interface with batch methods
- Add production environment auto-detection for smart logging
- Auto-cleanup legacy /index folder during initialization

Socket usage: Reduced from 1400+ concurrent to 3 max concurrent

Expected production result:
- Service initialization will complete successfully
- firehoseServiceInitialized: true
- Data collection will begin normally
- No more socket exhaustion errors (100 socket limit exceeded)

Fixes: #socket-exhaustion
Breaking: None - backward compatible with fallback modes
2025-08-07 11:46:07 -07:00
..
adapters feat(storage): fix critical socket exhaustion during metadata reading 2025-08-07 11:46:07 -07:00
backwardCompatibility.ts feat: migrate system metadata from 'index' to '_system' directory with backward compatibility 2025-08-06 09:45:56 -07:00
baseStorage.ts feat: v0.49 - Filter discovery API, remove deprecated methods, improve performance 2025-08-06 14:39:33 -07:00
cacheManager.ts fix(core): resolve TypeScript compilation errors and test failures 2025-08-04 20:00:38 -07:00
enhancedCacheManager.ts feat(hnsw): implement comprehensive large-scale search optimizations 2025-08-03 16:41:11 -07:00
readOnlyOptimizations.ts fix(types): add explicit ArrayBuffer type assertions for compression 2025-08-03 16:56:09 -07:00
storageFactory.ts refactor: simplify build system and improve model loading flexibility 2025-08-05 16:09:30 -07:00