bito-code-review[bot] commented on PR #40866:
URL: https://github.com/apache/superset/pull/40866#issuecomment-4652201838

   <!-- Bito Reply -->
   The flagged issue is correct. Because `processStreamResults` is now `async` 
and yields control to the event loop, the caller `subscribeToGlobalStream` 
(which does not `await` the listener) can proceed to fetch and process 
subsequent batches from Redis before the current batch has finished processing. 
This interleaving breaks the sequential processing order.
   
   To resolve this, the listener contract should be updated to be 
`async`-aware, and the stream consumer must `await` the listener's completion 
before advancing to the next batch. 
   
   Here is a minimal fix for `superset-websocket/src/index.ts`:
   
   ```typescript
   // In subscribeToGlobalStream, ensure the listener is awaited:
   await listener(results as StreamResult[]);
   ```
   
   I have validated this based on the provided diff. Would you like me to check 
the rest of the comments on this PR and implement fixes for them as well?
   
   **superset-websocket/src/index.ts**
   ```
   await listener(results as StreamResult[]);
   ```


-- 
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