Skip to content

Commit

Permalink
Use float data type for timeout instead of int
Browse files Browse the repository at this point in the history
  • Loading branch information
piby180 committed Jul 14, 2024
1 parent faad0d7 commit 507fb02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def cursor(self):
if not self.session or self.session.is_closed:
self.session = httpx.Client(
verify=self._kwargs.get('verify_ssl'),
timeout=int(self._kwargs.get('timeout')) if self._kwargs.get('timeout') else None)
timeout=float(self._kwargs.get('timeout')) if self._kwargs.get('timeout') else None)

self._kwargs['session'] = self.session
cursor = Cursor(*self._args, **self._kwargs)
Expand Down Expand Up @@ -213,7 +213,7 @@ def cursor(self):
if not self.session or self.session.is_closed:
self.session = httpx.AsyncClient(
verify=self._kwargs.get('verify_ssl'),
timeout=int(self._kwargs.get('timeout')) if self._kwargs.get('timeout') else None)
timeout=float(self._kwargs.get('timeout')) if self._kwargs.get('timeout') else None)

self._kwargs['session'] = self.session
cursor = AsyncCursor(*self._args, **self._kwargs)
Expand Down Expand Up @@ -286,7 +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,
timeout=10.0,
extra_request_headers="",
debug=False,
preserve_types=False,
Expand Down
4 changes: 2 additions & 2 deletions pinotdb/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +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 = int(kwargs.get('timeout')) if kwargs.get('timeout') else None
kwargs["timeout"] = self._timeout = float(kwargs.get('timeout')) if kwargs.get('timeout') else 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 @@ -209,7 +209,7 @@ def create_connect_args(self, url):
"username": url.username,
"password": url.password,
"verify_ssl": self._verify_ssl or True,
"timeout": int(self._timeout) if self._timeout else 10.0,
"timeout": float(self._timeout) if self._timeout else 10.0,
}
if self.engine_type == "multi_stage":
kwargs.update({"use_multistage_engine": True})
Expand Down

0 comments on commit 507fb02

Please sign in to comment.