Skip to content

Commit f2269d1

Browse files
authored
fix: parse ES_TIMEOUT environment variable to int (#556)
**Related Issue(s):** N/A **Description:** Parse the ES_TIMEOUT environment variable to `int` when adding it to the Elasticsearch/OpenSearch configuration dictionary. **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [ ] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog
1 parent 4139cb4 commit f2269d1

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
### Fixed
1717

1818
- Fix unawaited coroutine in `stac_fastapi.core.core`. [#551](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/551)
19+
- Parse `ES_TIMEOUT` environment variable as an integer. [#556](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/556)
1920

2021
### Removed
2122

compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
- ES_PORT=9200
2121
- ES_USE_SSL=false
2222
- ES_VERIFY_CERTS=false
23+
- ES_TIMEOUT=30
2324
- BACKEND=elasticsearch
2425
- DATABASE_REFRESH=true
2526
- ENABLE_COLLECTIONS_SEARCH_ROUTE=true
@@ -60,6 +61,7 @@ services:
6061
- ES_PORT=9202
6162
- ES_USE_SSL=false
6263
- ES_VERIFY_CERTS=false
64+
- ES_TIMEOUT=30
6365
- BACKEND=opensearch
6466
- STAC_FASTAPI_RATE_LIMIT=200/minute
6567
- ENABLE_COLLECTIONS_SEARCH_ROUTE=true

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _es_config() -> Dict[str, Any]:
5858

5959
# Include timeout setting if set
6060
if request_timeout := os.getenv("ES_TIMEOUT"):
61-
config["request_timeout"] = request_timeout
61+
config["request_timeout"] = int(request_timeout)
6262

6363
# Explicitly exclude SSL settings when not using SSL
6464
if not use_ssl:

stac_fastapi/opensearch/stac_fastapi/opensearch/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _es_config() -> Dict[str, Any]:
5656

5757
# Include timeout setting if set
5858
if timeout := os.getenv("ES_TIMEOUT"):
59-
config["timeout"] = timeout
59+
config["timeout"] = int(timeout)
6060

6161
# Explicitly exclude SSL settings when not using SSL
6262
if not use_ssl:

0 commit comments

Comments
 (0)