Skip to content

Commit 6b30972

Browse files
committed
Resolution fallback counting towards connection acquisition timeout
1 parent debf8a4 commit 6b30972

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/neo4j/_async/io/_pool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,9 @@ async def acquire(
11371137
if access_mode not in {WRITE_ACCESS, READ_ACCESS}:
11381138
# TODO: 6.0 - change this to be a ValueError
11391139
raise ClientError(f"Non valid 'access_mode'; {access_mode}")
1140-
if not timeout:
1140+
if (
1141+
isinstance(timeout, Deadline) and not timeout.original_timeout
1142+
) or not timeout:
11411143
# TODO: 6.0 - change this to be a ValueError
11421144
raise ClientError(
11431145
f"'timeout' must be a float larger than 0; {timeout}"

src/neo4j/_async/work/workspace.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from ..._async_compat.util import AsyncUtil
2323
from ..._auth_management import to_auth_dict
2424
from ..._conf import WorkspaceConfig
25+
from ..._deadline import Deadline
2526
from ..._meta import (
2627
deprecation_warn,
2728
unclosed_resource_warn,
@@ -191,7 +192,7 @@ async def _connect(self, access_mode, auth=None, **acquire_kwargs) -> None:
191192
)
192193
acquire_kwargs_ = {
193194
"access_mode": access_mode,
194-
"timeout": acquisition_timeout,
195+
"timeout": Deadline(acquisition_timeout),
195196
"database": target_db,
196197
"bookmarks": await self._get_bookmarks(),
197198
"auth": acquire_auth,

src/neo4j/_sync/io/_pool.py

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/neo4j/_sync/work/workspace.py

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)