11e7c71fd1
- Add environment variable configuration (BAILEYS_BUFFER_*) - Implement destroy() method for proper resource cleanup - Add force flush capability with flush(force) parameter - Implement buffer overflow detection and prevention - Add adaptive timeout algorithm based on event rate - Replace historyCache.clear() with LRU cache cleanup - Integrate Prometheus metrics for buffer monitoring - Add isDestroyed state protection - Fix createBufferedFunction to prevent orphaned timers - Add comprehensive statistics tracking (getStatistics()) - Add configuration accessor (getConfig()) Enterprise features: - Configurable buffer size limits (maxBufferSize) - Configurable timeout ranges (min/max) - LRU cleanup ratio configuration - Buffer overflow warning threshold - Adaptive timeout based on event rate