From 3a14709aee719f88537f0b4af3654d414a180e21 Mon Sep 17 00:00:00 2001 From: elitonzky Date: Fri, 13 Dec 2024 17:19:13 -0300 Subject: [PATCH] fix: call initial_sync_products_completed after first sync and adjust validate_sync_status --- marketplace/services/vtex/generic_service.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/marketplace/services/vtex/generic_service.py b/marketplace/services/vtex/generic_service.py index 096a73f8..c861702e 100644 --- a/marketplace/services/vtex/generic_service.py +++ b/marketplace/services/vtex/generic_service.py @@ -150,17 +150,14 @@ def first_product_insert( pvt_service = self.get_private_service( credentials.app_key, credentials.app_token ) - + # TODO: calculate whether there was any success in sending to return products = pvt_service.list_all_products( domain=credentials.domain, catalog=catalog, sellers=sellers, upload_on_sync=True, # Enable upload during synchronization ) - - if not products: - return None - + print(f"First product sync completed for Catalog: {catalog.name}") self.app_manager.initial_sync_products_completed(catalog.vtex_app) return products @@ -549,7 +546,7 @@ def _get_credentials(vtex_app) -> dict: def _validate_sync_status(vtex_app) -> None: can_synchronize = vtex_app.config.get("initial_sync_completed", False) if not can_synchronize: - raise ValueError("Missing one or more API credentials.") + raise ValueError("Initial synchronization not completed.") print("validate_sync_status - Ok")