Copilot commented on code in PR #6522:
URL: https://github.com/apache/texera/pull/6522#discussion_r3610248914


##########
amber/src/main/python/core/architecture/handlers/control/end_worker_handler.py:
##########
@@ -41,9 +41,13 @@ async def end_worker(self, req: EmptyRequest) -> EmptyReturn:
         input_queue: IQueue = self.context.input_queue
         if not input_queue.is_empty():
             logger.warning(
-                f"Received EndHandler before all messages are "
-                f"processed. Unprocessed messages: {input_queue.get()}"
+                f"Received EndWorker before all {len(input_queue)} queued "
+                f"message(s) were processed; failing the RPC so the 
coordinator "

Review Comment:
   `input_queue` is annotated as `IQueue`, but this interface doesn't define 
`__len__`, so `len(input_queue)` is inconsistent with the declared type and can 
trip static analysis / future alternate queue implementations. Also, you can 
avoid the double-check (`is_empty()` + `len(...)`) by computing the queued 
count once and branching on it.



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

Reply via email to