]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/freeze.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / nominatim / clicmd / freeze.py
index 8bca04b995f1240782ab27c92e4326db2f1ad9f3..1b311e97f2f7ee1081c4d1706501b9591c08704c 100644 (file)
@@ -29,9 +29,8 @@ class SetupFreeze:
     def run(args):
         from ..tools import freeze
 
     def run(args):
         from ..tools import freeze
 
-        conn = connect(args.config.get_libpq_dsn())
-        freeze.drop_update_tables(conn)
+        with connect(args.config.get_libpq_dsn()) as conn:
+            freeze.drop_update_tables(conn)
         freeze.drop_flatnode_file(args.config.FLATNODE_FILE)
         freeze.drop_flatnode_file(args.config.FLATNODE_FILE)
-        conn.close()
 
         return 0
 
         return 0