From 636973c16ae9a080b43494a3b988cddd3f7c9176 Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 20 Oct 2023 11:07:58 -0400 Subject: [PATCH] fix race condition error due to consecutive requests --- app/contacts/contact_tcp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/contacts/contact_tcp.py b/app/contacts/contact_tcp.py index 35f942c8f..d6ff0b754 100644 --- a/app/contacts/contact_tcp.py +++ b/app/contacts/contact_tcp.py @@ -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)