Skip to content

Commit

Permalink
fix race condition error due to consecutive requests
Browse files Browse the repository at this point in the history
  • Loading branch information
bleepbop committed Oct 20, 2023
1 parent 4643964 commit 636973c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/contacts/contact_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async def send(self, session_id: int, cmd: str, timeout: int = 60) -> Tuple[int,
try:
conn = next(i.connection for i in self.sessions if i.id == int(session_id))
conn.send(str.encode(' '))
time.sleep(0.01)
conn.send(str.encode('%s\n' % cmd))
response = await self._attempt_connection(session_id, conn, timeout=timeout)
response = json.loads(response)
Expand Down

0 comments on commit 636973c

Please sign in to comment.