fix(emergency): drastically lower high-volume mode activation thresholds

EMERGENCY FIX for bluesky-package socket exhaustion despite v0.54.1

🚨 CRITICAL CHANGES:
- Activation threshold: 100 → 1 pending operation (configurable)
- Add socket utilization trigger: >10% usage activates buffering
- Add environment variables:
  - BRAINY_BUFFER_THRESHOLD=1 (when to start buffering)
  - BRAINY_FORCE_BUFFERING=true (force enable)
- Add comprehensive logging with emojis for visibility:
  - '🚨 HIGH-VOLUME MODE ACTIVATED 🚨' when buffering starts
  - '🚀 BATCH FLUSH: N items → 1 bulk S3 operation' for batch writes
  - '📈 BUFFER GROWTH: N items buffered' every 100 additions

PROBLEM: v0.54.1 buffering not activating with 7,500 pending requests
SOLUTION: Activate buffering at first sign of load (1+ pending operations)

This should immediately activate buffering in bluesky-package production.
This commit is contained in:
David Snelling 2025-08-07 09:51:22 -07:00
parent a0d736472c
commit b989e72be4
5 changed files with 151 additions and 23 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@soulcraft/brainy",
"version": "0.54.1",
"version": "0.54.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@soulcraft/brainy",
"version": "0.54.1",
"version": "0.54.2",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "^3.540.0",