Skip to content
Permalink
Browse files

feat(stream-call): only 1000 pending tasks

  • Loading branch information...
numb3r3 committed Sep 16, 2019
1 parent b4007ba commit ea89d8cb4718dddc03bea216093af4ec211650da
Showing with 10 additions and 2 deletions.
  1. +10 −2 gnes/service/frontend.py
@@ -142,10 +142,18 @@ def StreamCall(self, request_iterator, context):
zmq_client.send_message(self.add_envelope(request, zmq_client), self.args.timeout)
num_request += 1

while True:
while num_request > 10:
try:
# fetch response in real time to reduce network overload
msg = zmq_client.recv_message(10)
timeout = 50
if self.args.timeout > 0:
timeout = min(0.5 * self.args.timeout, 100)

# only 1000 pending tasks are approved
if num_request > 1000:
timeout = -1

msg = zmq_client.recv_message(timeout)
yield self.remove_envelope(msg)
num_request -= 1
except TimeoutError:

0 comments on commit ea89d8c

Please sign in to comment.
You can’t perform that action at this time.