✅ 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:
parent
c4ec3fac9f
commit
371c0a4591
@ -546,8 +546,8 @@ class OKXWebSocketClient:
|
|||||||
|
|
||||||
# Use lock to prevent concurrent reconnection attempts
|
# Use lock to prevent concurrent reconnection attempts
|
||||||
try:
|
try:
|
||||||
# Use asyncio.wait_for to prevent hanging on lock acquisition
|
# Properly acquire lock with timeout
|
||||||
async with asyncio.wait_for(self._reconnection_lock.acquire(), timeout=5.0):
|
await asyncio.wait_for(self._reconnection_lock.acquire(), timeout=5.0)
|
||||||
try:
|
try:
|
||||||
# Double-check we still need to reconnect
|
# Double-check we still need to reconnect
|
||||||
if (self._connection_state == ConnectionState.DISCONNECTED and
|
if (self._connection_state == ConnectionState.DISCONNECTED and
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user