Skip to content

Commit

Permalink
Added config option for setting timeout of ncss-related requests (#316)
Browse files Browse the repository at this point in the history
Also set a default value of 30s (the previous value was 5s, which is httpx's default)
  • Loading branch information
ricardogsilva authored Dec 2, 2024
1 parent 297c57a commit 0e18040
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions arpav_ppcv/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ThreddsServerSettings(pydantic.BaseModel):
base_url: str = "http://localhost:8080/thredds"
wms_service_url_fragment: str = "wms"
netcdf_subset_service_url_fragment: str = "ncss/grid" # noqa
netcdf_subset_service_timeout_seconds: int = 30 # noqa
opendap_service_url_fragment: str = "dodsC" # noqa
uncertainty_visualization_scale_range: tuple[float, float] = pydantic.Field(
default=(0, 9)
Expand Down
3 changes: 3 additions & 0 deletions arpav_ppcv/webapp/api_v2/routers/coverages.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ async def get_forecast_data(
fitted_bbox = None

cache_key = datadownloads.get_cache_key(coverage, fitted_bbox, temporal_range)
http_client.timeout = (
settings.thredds_server.netcdf_subset_service_timeout_seconds
)
response_to_stream = await datadownloads.retrieve_coverage_data(
settings, http_client, cache_key, coverage, fitted_bbox, temporal_range
)
Expand Down

0 comments on commit 0e18040

Please sign in to comment.