From ea9644b7e2cfa4c0c1d3c4414abb8bf71bcf6558 Mon Sep 17 00:00:00 2001 From: Chris Cherniakov Date: Tue, 3 Sep 2024 10:58:40 -0400 Subject: [PATCH] HTTP driver timeout bugfix (#34) HTTP driver did not pull the correct integer value for connection timeout. Fixed. --- .gitignore | 1 + singlestoredb/http/connection.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 650ad6f89..7b1ed9d7a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ .ipynb_checkpoints .tags .vscode +.venv ## Compiled source *.com diff --git a/singlestoredb/http/connection.py b/singlestoredb/http/connection.py index 4ec48e913..e38cdae93 100644 --- a/singlestoredb/http/connection.py +++ b/singlestoredb/http/connection.py @@ -386,6 +386,8 @@ def _post(self, path: str, *args: Any, **kwargs: Any) -> requests.Response: """ if self._connection is None: raise ProgrammingError(errno=2048, msg='Connection is closed.') + if 'timeout' not in kwargs: + kwargs['timeout'] = self._connection.connection_params['connect_timeout'] return self._connection._post(path, *args, **kwargs) def callproc( @@ -1126,9 +1128,6 @@ def _post(self, path: str, *args: Any, **kwargs: Any) -> requests.Response: self._sync_connection(kwargs) - if 'timeout' not in kwargs: - kwargs['timeout'] = get_option('connect_timeout') - return self._sess.post(urljoin(self._url, path), *args, **kwargs) def close(self) -> None: