Skip to content

Commit ac82a33

Browse files
committed
Close readpool only if it exists
1 parent 990b2af commit ac82a33

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- Close readpool only if it exists ([#330](https://github.com/stac-utils/stac-fastapi-pgstac/pull/330))
8+
59
## [6.1.2] - 2025-11-24
610

711
### Changed

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)