]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/freeze.py
Merge pull request #2525 from lonvia/fix-replication-indexer
[nominatim.git] / nominatim / clicmd / freeze.py
index 8bca04b995f1240782ab27c92e4326db2f1ad9f3..41dd610ed67f8f2246cda918f94f4558895730e1 100644 (file)
@@ -2,7 +2,7 @@
 Implementation of the 'freeze' subcommand.
 """
 
-from ..db.connection import connect
+from nominatim.db.connection import connect
 
 # Do not repeat documentation of subcommand classes.
 # pylint: disable=C0111
@@ -29,9 +29,8 @@ class SetupFreeze:
     def run(args):
         from ..tools import freeze
 
-        conn = connect(args.config.get_libpq_dsn())
-        freeze.drop_update_tables(conn)
-        freeze.drop_flatnode_file(args.config.FLATNODE_FILE)
-        conn.close()
+        with connect(args.config.get_libpq_dsn()) as conn:
+            freeze.drop_update_tables(conn)
+        freeze.drop_flatnode_file(str(args.config.get_path('FLATNODE_FILE')))
 
         return 0