Skip to content

Commit

Permalink
(dbt-labs#2195) DBT_HTTP_TIMEOUT moved inside system download call
Browse files Browse the repository at this point in the history
  • Loading branch information
Raalsky committed Mar 23, 2020
1 parent d6cb415 commit 1c60882
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/dbt/clients/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ def run_cmd(


def download(url: str, path: str, timeout: Union[float, tuple] = None) -> None:
response = requests.get(url, timeout=timeout)
connection_timeout = timeout or float(os.getenv('DBT_HTTP_TIMEOUT', 10))
response = requests.get(url, timeout=connection_timeout)
with open(path, 'wb') as handle:
for block in response.iter_content(1024 * 64):
handle.write(block)
Expand Down
3 changes: 1 addition & 2 deletions core/dbt/deps/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def _fetch_metadata(self, project, renderer) -> RegistryPackageMetadata:
return RegistryPackageMetadata.from_dict(dct)

def install(self, project, renderer):
connection_timeout = float(os.getenv('DBT_HTTP_TIMEOUT', 10))
metadata = self.fetch_metadata(project, renderer)

tar_name = '{}.{}.tar.gz'.format(self.package, self.version)
Expand All @@ -62,7 +61,7 @@ def install(self, project, renderer):
system.make_directory(os.path.dirname(tar_path))

download_url = metadata.downloads.tarball
system.download(download_url, tar_path, timeout=connection_timeout)
system.download(download_url, tar_path)
deps_path = project.modules_path
package_name = self.get_project_name(project, renderer)
system.untar_package(tar_path, deps_path, package_name)
Expand Down

0 comments on commit 1c60882

Please sign in to comment.