Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
refactor(frontend): realtime response to reduce network overload
  • Loading branch information
felix committed Sep 16, 2019
1 parent 7b82678 commit b4007ba6273be7abd15d2d649020a95f670d05f3
Showing with 9 additions and 0 deletions.
  1. +9 −0 gnes/service/frontend.py
@@ -142,6 +142,15 @@ def StreamCall(self, request_iterator, context):
zmq_client.send_message(self.add_envelope(request, zmq_client), self.args.timeout)
num_request += 1

while True:
try:
# fetch response in real time to reduce network overload
msg = zmq_client.recv_message(10)
yield self.remove_envelope(msg)
num_request -= 1
except TimeoutError:
break

for _ in range(num_request):
msg = zmq_client.recv_message(self.args.timeout)
yield self.remove_envelope(msg)

0 comments on commit b4007ba

Please sign in to comment.