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

@@ -136,6 +136,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 +149,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: