Skip to content

Commit

Permalink
feat: use async_timeout instead of asyncio.wait_for (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Sep 26, 2022
1 parent d71f0e1 commit cb31780
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sphinxcontrib-fulltoc = {version = "^1.2.0", extras = ["docs"]}
Sphinx = {version = "^5.1.1", extras = ["docs"]}
myst-parser = {version = "^0.18.0", extras = ["docs"]}
sphinx-rtd-theme = {version = "^1.0.0", extras = ["docs"]}
async-timeout = ">=4.0.1"

[tool.poetry.extras]
docs = [
Expand Down
5 changes: 4 additions & 1 deletion src/dbus_fast/aio/message_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from copy import copy
from typing import Any, Optional

import async_timeout

from .. import introspection as intr
from .._private.unmarshaller import Unmarshaller
from ..auth import Authenticator, AuthExternal
Expand Down Expand Up @@ -257,7 +259,8 @@ def reply_handler(reply: Any, err: Exception) -> None:

super().introspect(bus_name, path, reply_handler)

return await asyncio.wait_for(future, timeout=timeout)
async with async_timeout.timeout(timeout):
return await future

async def request_name(
self, name: str, flags: NameFlag = NameFlag.NONE
Expand Down

0 comments on commit cb31780

Please sign in to comment.