X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/cf19036ce6f17ce16bdc733d460a60b064a9d5c5..9d31a6711605cd4ebea09ca1675e2549b706ba5b:/nominatim/api.py diff --git a/nominatim/api.py b/nominatim/api.py index f5e942d1..e129c4f8 100644 --- a/nominatim/api.py +++ b/nominatim/api.py @@ -38,6 +38,14 @@ class NominatimAPIAsync: future=True) + async def close(self) -> None: + """ Close all active connections to the database. The NominatimAPIAsync + object remains usable after closing. If a new API functions is + called, new connections are created. + """ + await self.engine.dispose() + + async def status(self) -> StatusResult: """ Return the status of the database. """ @@ -53,6 +61,14 @@ class NominatimAPI: self.async_api = NominatimAPIAsync(project_dir, environ) + def close(self) -> None: + """ Close all active connections to the database. The NominatimAPIAsync + object remains usable after closing. If a new API functions is + called, new connections are created. + """ + asyncio.get_event_loop().run_until_complete(self.async_api.close()) + + def status(self) -> StatusResult: """ Return the status of the database. """