@@ -659,6 +659,7 @@ def stop(self):
659659 self ._logger .info ("Worker shutdown completed" )
660660 self ._is_running = False
661661
662+ # TODO: This should be removed in the future as we do handle grpc errs
662663 def _handle_grpc_execution_error (self , rpc_error : grpc .RpcError , request_type : str ):
663664 """Handle a gRPC execution error during shutdown or benign condition."""
664665 # During shutdown or if the instance was terminated, the channel may be close
@@ -720,9 +721,8 @@ def _execute_orchestrator(
720721
721722 try :
722723 stub .CompleteOrchestratorTask (res )
723- except grpc .RpcError :
724- # except grpc.RpcError as rpc_error: # type: ignore
725- raise # self._handle_grpc_execution_error(rpc_error, "orchestrator")
724+ except grpc .RpcError as rpc_error : # type: ignore
725+ self ._handle_grpc_execution_error (rpc_error , "orchestrator" )
726726 except Exception as ex :
727727 self ._logger .exception (
728728 f"Failed to deliver orchestrator response for '{ req .instanceId } ' to sidecar: { ex } "
@@ -754,10 +754,8 @@ def _execute_activity(
754754
755755 try :
756756 stub .CompleteActivityTask (res )
757- # except grpc.RpcError as rpc_error: # type: ignore
758- # self._handle_grpc_execution_error(rpc_error, "activity")
759- except grpc .RpcError :
760- raise
757+ except grpc .RpcError as rpc_error : # type: ignore
758+ self ._handle_grpc_execution_error (rpc_error , "activity" )
761759 except Exception as ex :
762760 self ._logger .exception (
763761 f"Failed to deliver activity response for '{ req .name } #{ req .taskId } ' of orchestration ID '{ instance_id } ' to sidecar: { ex } "
0 commit comments