Skip to content

Commit 8b02c13

Browse files
authored
Make redis imports optional (#549)
**Related Issue(s):** - #548 **Description:** - Made redis imports contingent on redis env var being enabled **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [x] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog
1 parent 8cbd482 commit 8b02c13

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
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
- Fix incorrect min/max date formatting in `apply_datetime_filter` for `POST` requests. [#539](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/539)
1717
- Fixed datetime filtering for .0Z milliseconds to preserve precision in apply_filter_datetime, ensuring only items exactly within the specified range are returned. [#535](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/535)
1818
- Normalize datetime in POST /search requests to match GET /search behavior. [#543](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/543)
19+
- Fix optional Redis support in core.py. [#549](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/549)
1920

2021
### Removed
2122

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from stac_fastapi.core.base_settings import ApiBaseSettings
2525
from stac_fastapi.core.datetime_utils import format_datetime_range
2626
from stac_fastapi.core.models.links import PagingLinks
27-
from stac_fastapi.core.redis_utils import redis_pagination_links
2827
from stac_fastapi.core.serializers import CollectionSerializer, ItemSerializer
2928
from stac_fastapi.core.session import Session
3029
from stac_fastapi.core.utilities import filter_fields, get_bool_env
@@ -426,6 +425,8 @@ async def all_collections(
426425
]
427426

428427
if redis_enable:
428+
from stac_fastapi.core.redis_utils import redis_pagination_links
429+
429430
await redis_pagination_links(
430431
current_url=str(request.url),
431432
token=token,
@@ -904,6 +905,8 @@ async def post_search(
904905
links.extend(collection_links)
905906

906907
if redis_enable:
908+
from stac_fastapi.core.redis_utils import redis_pagination_links
909+
907910
await redis_pagination_links(
908911
current_url=str(request.url),
909912
token=token_param,

0 commit comments

Comments
 (0)