ソースを参照

remove stream_output from call_protobuf_handler

Denis Mazur 4 年 前
コミット
1feb884d8a
2 ファイル変更2 行追加6 行削除
  1. 2 5
      hivemind/p2p/p2p_daemon.py
  2. 0 1
      hivemind/p2p/servicer.py

+ 2 - 5
hivemind/p2p/p2p_daemon.py

@@ -460,15 +460,12 @@ class P2P:
         name: str,
         input: Union[TInputProtobuf, TInputStream],
         output_protobuf_type: type,
-        *,
-        stream_output: bool = False,
     ) -> Awaitable[TOutputProtobuf]:
 
-        if not (isinstance(input, AsyncIterableABC) or stream_output):
+        if not isinstance(input, AsyncIterableABC):
             return await self._call_unary_protobuf_handler(peer_id, name, input, output_protobuf_type)
 
-        requests = input if isinstance(input, AsyncIterableABC) else aiter(input)
-        responses = self._iterate_protobuf_stream_handler(peer_id, name, requests, output_protobuf_type)
+        responses = self._iterate_protobuf_stream_handler(peer_id, name, input, output_protobuf_type)
 
         count = 0
         async for response in responses:

+ 0 - 1
hivemind/p2p/servicer.py

@@ -103,7 +103,6 @@ class ServicerBase:
                         handler.handle_name,
                         input,
                         handler.response_type,
-                        stream_output=handler.stream_output,
                     ),
                     timeout=timeout,
                 )