X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b169e4c88cd99075c7e932aeb6587c97f51e7ed1..2af82975cd968ec09683ae5b16a9aa157a7f2176:/nominatim/clicmd/admin.py?ds=sidebyside diff --git a/nominatim/clicmd/admin.py b/nominatim/clicmd/admin.py index e5863575..fd9382eb 100644 --- a/nominatim/clicmd/admin.py +++ b/nominatim/clicmd/admin.py @@ -54,9 +54,8 @@ class AdminFuncs: if args.analyse_indexing: LOG.warning('Analysing performance of indexing function') from ..tools import admin - conn = connect(args.config.get_libpq_dsn()) - admin.analyse_indexing(conn, osm_id=args.osm_id, place_id=args.place_id) - conn.close() + with connect(args.config.get_libpq_dsn()) as conn: + admin.analyse_indexing(conn, osm_id=args.osm_id, place_id=args.place_id) return 0