Browse Source

Future proof usage of async_timeout

pull/9628/head
Imayhaveborkedit 1 year ago
committed by GitHub
parent
commit
c7edfc7c16
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      discord/voice_state.py
  2. 1
      requirements.txt

7
discord/voice_state.py

@ -45,7 +45,10 @@ import asyncio
import logging
import threading
import async_timeout
try:
from asyncio import timeout as atimeout # type: ignore
except ImportError:
from async_timeout import timeout as atimeout # type: ignore
from typing import TYPE_CHECKING, Optional, Dict, List, Callable, Coroutine, Any, Tuple
@ -378,7 +381,7 @@ class VoiceConnectionState:
async def _connect(self, reconnect: bool, timeout: float, self_deaf: bool, self_mute: bool, resume: bool) -> None:
_log.info('Connecting to voice...')
async with async_timeout.timeout(timeout):
async with atimeout(timeout):
for i in range(5):
_log.info('Starting voice handshake... (connection attempt %d)', i + 1)

1
requirements.txt

@ -1 +1,2 @@
aiohttp>=3.7.4,<4
async-timeout>=4.0,<5.0; python_version<"3.11"

Loading…
Cancel
Save