rename wait_for()'s timeout param, actually use it
This commit is contained in:
parent
8bb95949ed
commit
6d2cf3f465
1 changed files with 4 additions and 4 deletions
|
@ -7,7 +7,7 @@ from time import monotonic
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
from asyncio_throttle import Throttler
|
from asyncio_throttle import Throttler
|
||||||
from async_timeout import timeout
|
from async_timeout import timeout as timeout_
|
||||||
from ircstates import Emit, Channel, ChannelUser
|
from ircstates import Emit, Channel, ChannelUser
|
||||||
from ircstates.numerics import *
|
from ircstates.numerics import *
|
||||||
from ircstates.server import ServerDisconnectedException
|
from ircstates.server import ServerDisconnectedException
|
||||||
|
@ -206,7 +206,7 @@ class Server(IServer):
|
||||||
ping_sent = False
|
ping_sent = False
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
async with timeout(PING_TIMEOUT):
|
async with timeout_(PING_TIMEOUT):
|
||||||
data = await self._reader.read(1024)
|
data = await self._reader.read(1024)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
if ping_sent:
|
if ping_sent:
|
||||||
|
@ -268,7 +268,7 @@ class Server(IServer):
|
||||||
async def wait_for(self,
|
async def wait_for(self,
|
||||||
response: Union[IMatchResponse, Set[IMatchResponse]],
|
response: Union[IMatchResponse, Set[IMatchResponse]],
|
||||||
sent_aw: Optional[Awaitable[SentLine]]=None,
|
sent_aw: Optional[Awaitable[SentLine]]=None,
|
||||||
wtimeout: float=WAIT_TIMEOUT
|
timeout: float=WAIT_TIMEOUT
|
||||||
) -> Line:
|
) -> Line:
|
||||||
|
|
||||||
response_obj: IMatchResponse
|
response_obj: IMatchResponse
|
||||||
|
@ -290,7 +290,7 @@ class Server(IServer):
|
||||||
label = str(sent_line.id)
|
label = str(sent_line.id)
|
||||||
our_wait_for.with_label(label)
|
our_wait_for.with_label(label)
|
||||||
|
|
||||||
async with timeout(WAIT_TIMEOUT):
|
async with timeout_(timeout):
|
||||||
return (await our_wait_for)
|
return (await our_wait_for)
|
||||||
|
|
||||||
async def _on_send_line(self, line: Line):
|
async def _on_send_line(self, line: Line):
|
||||||
|
|
Loading…
Reference in a new issue