X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/72b01148d2d12f71c12440c15fa078b55e1c8f86..4080fbb95cd2a12c93276c1f6e58226d1c534406:/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