Skip to content

Commit c869d37

Browse files
Merge pull request #325 from ChamRun/python_loop_fix
Python loop fix
2 parents 7a7ae58 + 3bed207 commit c869d37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/rpc_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def __init__(self):
1919
on_message_callback=self.on_response,
2020
auto_ack=True)
2121

22+
self.response = None
23+
self.corr_id = None
24+
2225
def on_response(self, ch, method, props, body):
2326
if self.corr_id == props.correlation_id:
2427
self.response = body
@@ -34,8 +37,7 @@ def call(self, n):
3437
correlation_id=self.corr_id,
3538
),
3639
body=str(n))
37-
while self.response is None:
38-
self.connection.process_data_events()
40+
self.connection.process_data_events(time_limit=None)
3941
return int(self.response)
4042

4143

0 commit comments

Comments
 (0)