Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
akindofyoga committed Nov 30, 2023
1 parent ff3e6a4 commit b8cd5e8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/src/gabriel_server/local_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ async def _engine_comm(self):
self._conn.send_bytes(from_client.input_frame.SerializeToString())
result_wrapper = gabriel_pb2.ResultWrapper()

if not self._conn.poll():
while not self._conn.poll():
await self._result_ready.wait()
self._result_ready.clear()

result_wrapper.ParseFromString(self._conn.recv_bytes())
await self.send_result_wrapper(
address, from_client.source_name, from_client.frame_id,
result_wrapper, return_token=True)

self._result_ready.clear()


def _run_engine(engine_factory, conn):
engine = engine_factory()
Expand Down

0 comments on commit b8cd5e8

Please sign in to comment.