X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/771aee8cd80f9dc5303331053e9b08a901a620e0..1821f68ca0915c0b797efdbae8b2672f9c81985f:/nominatim/clicmd/replication.py diff --git a/nominatim/clicmd/replication.py b/nominatim/clicmd/replication.py index 44eec5f1..9d946304 100644 --- a/nominatim/clicmd/replication.py +++ b/nominatim/clicmd/replication.py @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2022 by the Nominatim developer community. +# For a full list of authors see the git log. """ Implementation of the 'replication' sub-command. """ @@ -15,7 +21,7 @@ LOG = logging.getLogger() # Do not repeat documentation of subcommand classes. # pylint: disable=C0111 # Using non-top-level imports to make pyosmium optional for replication only. -# pylint: disable=E0012,C0415 +# pylint: disable=C0415 class UpdateReplication: """\ @@ -90,8 +96,7 @@ class UpdateReplication: end = dt.datetime.now(dt.timezone.utc) LOG.warning("Update completed. Import: %s. %sTotal: %s. Remaining backlog: %s.", round_time((start_index or end) - start_import), - "Indexing: {} ".format(round_time(end - start_index)) - if start_index else '', + f"Indexing: {round_time(end - start_index)} " if start_index else '', round_time(end - start_import), round_time(end - batchdate)) @@ -136,6 +141,7 @@ class UpdateReplication: recheck_interval = args.config.get_int('REPLICATION_RECHECK_INTERVAL') tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config) + indexer = Indexer(args.config.get_libpq_dsn(), tokenizer, args.threads or 1) while True: with connect(args.config.get_libpq_dsn()) as conn: @@ -148,8 +154,6 @@ class UpdateReplication: if state is not replication.UpdateState.NO_CHANGES and args.do_index: index_start = dt.datetime.now(dt.timezone.utc) - indexer = Indexer(args.config.get_libpq_dsn(), tokenizer, - args.threads or 1) indexer.index_full(analyse=False) with connect(args.config.get_libpq_dsn()) as conn: