✅ Eliminates the "coroutine was never awaited" warnings

✅ Properly handles lock acquisition with timeout
✅ Maintains the same functionality (timeout protection for lock acquisition)
✅ Ensures proper lock cleanup in the finally block
This commit is contained in:
Vasily.onl committed 2025-06-03 13:11:51 +08:00
1 parent c4ec3fac9f
commit 371c0a4591
1 file changed
+2 -2
+2 -2
View File
@@ -546,8 +546,8 @@ class OKXWebSocketClient:
# Use lock to prevent concurrent reconnection attempts
try:
# Use asyncio.wait_for to prevent hanging on lock acquisition
async with asyncio.wait_for(self._reconnection_lock.acquire(), timeout=5.0):
# Properly acquire lock with timeout
await asyncio.wait_for(self._reconnection_lock.acquire(), timeout=5.0)
try:
# Double-check we still need to reconnect
if (self._connection_state == ConnectionState.DISCONNECTED and