Skip to content

Commit

Permalink
Add close method to PostgreSQLOnlineStore
Browse files Browse the repository at this point in the history
Signed-off-by: Job Almekinders <[email protected]>
  • Loading branch information
job-almekinders committed Aug 13, 2024
1 parent 419ca5e commit bc9acfb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sdk/python/feast/infra/online_stores/contrib/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ async def _get_conn_async(
self._conn_async = await _get_conn_async(config.online_store)
yield self._conn_async

async def close(self):
"""Close all connections and connection pools."""
if self._conn is not None:
self._conn.close()
if self._conn_pool is not None:
self._conn_pool.close()

if self._conn_async is not None:
await self._conn_async.close()
if self._conn_pool_async is not None:
await self._conn_pool_async.close()

def online_write_batch(
self,
config: RepoConfig,
Expand Down

0 comments on commit bc9acfb

Please sign in to comment.