From 8dcd50b0f9dd7f923e81c7b3c5ab8935180ea2d0 Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Thu, 31 Aug 2023 14:55:36 -0700 Subject: [PATCH] hotfix zero-update writes these result in HTTP400 if attempt is made to write them to OpenSearch --- src/pds/registrysweepers/utils/db/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pds/registrysweepers/utils/db/__init__.py b/src/pds/registrysweepers/utils/db/__init__.py index 520606a..514a581 100644 --- a/src/pds/registrysweepers/utils/db/__init__.py +++ b/src/pds/registrysweepers/utils/db/__init__.py @@ -159,8 +159,9 @@ def write_updated_docs(host: Host, updates: Iterable[Update], index_name: str = remaining_products_to_write_count = int(len(bulk_updates_buffer) / 2) updated_doc_count += remaining_products_to_write_count - log.info(f"Writing documents updates for {remaining_products_to_write_count} remaining products to db...") - _write_bulk_updates_chunk(host, index_name, bulk_updates_buffer) + if len(bulk_updates_buffer) > 0: + log.info(f"Writing documents updates for {remaining_products_to_write_count} remaining products to db...") + _write_bulk_updates_chunk(host, index_name, bulk_updates_buffer) log.info(f"Updated documents for {updated_doc_count} total products!")