rusackas opened a new pull request, #40866:
URL: https://github.com/apache/superset/pull/40866

   ### SUMMARY
   
   `processStreamResults` iterated a Redis stream batch with a synchronous 
`forEach`. Under a high event volume a single large batch could monopolize the 
Node.js event loop, delaying connection handling, health checks and ping/pong 
processing for the whole sidecar.
   
   This processes the batch in an async loop that yields to the event loop (via 
`setImmediate`) every `eventYieldBatchSize` events:
   
   | Config | Env var | Default |
   |--------|---------|---------|
   | `eventYieldBatchSize` | `EVENT_YIELD_BATCH_SIZE` | `100` |
   
   Set to `0` to disable yielding. With the default of 100 (equal to the 
default `redisStreamReadCount`), typical batches are processed exactly as 
before; the yielding only engages for larger configured batches. 
`processStreamResults` now returns a `Promise<void>`; its existing call sites 
use it as a fire-and-forget listener and are unaffected.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — sidecar behavior.
   
   ### TESTING INSTRUCTIONS
   
   ```
   cd superset-websocket
   npm ci
   npm test
   ```
   
   New tests: a batch larger than the threshold yields (setImmediate invoked) 
and still delivers every event; with yielding disabled the whole batch is 
processed.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to