Skip to content

Commit 5b2919b

Browse files
authored
Close readpool only if it exists (#331)
1 parent ffcc60b commit 5b2919b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- avoid pydantic validation for `/collections` response when using `fields` extension ([#326](https://github.com/stac-utils/stac-fastapi-pgstac/pull/326))
8+
- Close readpool only if it exists ([#331](https://github.com/stac-utils/stac-fastapi-pgstac/pull/331))
89

910
## [6.1.2] - 2025-11-24
1011

stac_fastapi/pgstac/db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ async def connect_to_db(
8383

8484
async def close_db_connection(app: FastAPI) -> None:
8585
"""Close connection."""
86-
await app.state.readpool.close()
86+
if pool := getattr(app.state, "readpool", None):
87+
await pool.close()
8788
if pool := getattr(app.state, "writepool", None):
8889
await pool.close()
8990

0 commit comments

Comments
 (0)