Skip to content

Commit

Permalink
fix httpx timeout issue (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 authored Jul 13, 2024
1 parent 556da24 commit b0f2a4f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ wheels/
.installed.cfg
*.egg
.vscode/
.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
1 change: 1 addition & 0 deletions pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def __init__(
# TODO: Remove this unused parameter when we can afford to break the
# interface (e.g. new minor version).
verify_ssl=True,
timeout=10,
extra_request_headers="",
debug=False,
preserve_types=False,
Expand Down
3 changes: 3 additions & 0 deletions pinotdb/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def __init__(self, *args, **kwargs):
self._password = None
self._debug = False
self._verify_ssl = True
self._timeout = 10.0
self._database = None
self.update_from_kwargs(kwargs)

Expand All @@ -181,6 +182,7 @@ def update_from_kwargs(self, givenkw):
kwargs["database"] = self._database = kwargs.pop("database")
kwargs["debug"] = self._debug = bool(kwargs.get("debug", False))
kwargs["verify_ssl"] = self._verify_ssl = (str(kwargs.get("verify_ssl", "true")).lower() in ['true'])
kwargs["timeout"] = self._timeout = kwargs.get("timeout", None)
logger.info(
"Updated pinot dialect args from %s: %s and %s",
dict(map(lambda kv: (kv[0], mask_value(kv[0], kv[1], ['password'])), kwargs.items())),
Expand All @@ -207,6 +209,7 @@ def create_connect_args(self, url):
"username": url.username,
"password": url.password,
"verify_ssl": self._verify_ssl or True,
"timeout": self._timeout or 10.0,
}
if self.engine_type == "multi_stage":
kwargs.update({"use_multistage_engine": True})
Expand Down
14 changes: 7 additions & 7 deletions poetry.lock

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

3 changes: 3 additions & 0 deletions tests/unit/test_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_creates_connection_args(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
})

def test_creates_connection_args_without_query(self):
Expand All @@ -73,6 +74,7 @@ def test_creates_connection_args_without_query(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
})

def test_can_instantiate_with_server(self):
Expand Down Expand Up @@ -282,6 +284,7 @@ def test_creates_connection_args(self):
'username': None,
'password': None,
'verify_ssl': True,
'timeout': 10.0,
'use_multistage_engine': True,
})

Expand Down

0 comments on commit b0f2a4f

Please sign in to comment.