only instantiate indexer once for replication

Also makes sure that indexer object exists everywhere were needed.

See #2518.
This commit is contained in:
Sarah Hoffmann
2021-11-19 14:47:00 +01:00
parent 8dc1441635
commit 10e979e841
2 changed files with 11 additions and 2 deletions

View File

@@ -106,6 +106,16 @@ class TestCliReplication:
assert str(update_mock.last_args[1]['osm2pgsql']) == '/secret/osm2pgsql'
@pytest.mark.parametrize("update_interval", [60, 3600])
def test_replication_catchup(self, monkeypatch, index_mock, update_interval, placex_table):
monkeypatch.setenv('NOMINATIM_REPLICATION_UPDATE_INTERVAL', str(update_interval))
states = [nominatim.tools.replication.UpdateState.NO_CHANGES]
monkeypatch.setattr(nominatim.tools.replication, 'update',
lambda *args, **kwargs: states.pop())
assert self.call_nominatim('--catch-up') == 0
def test_replication_update_custom_threads(self, update_mock):
assert self.call_nominatim('--once', '--no-index', '--threads', '4') == 0