Skip to content

Commit

Permalink
fix: call initial_sync_products_completed after first sync and adjust…
Browse files Browse the repository at this point in the history
… validate_sync_status
  • Loading branch information
elitonzky committed Dec 13, 2024
1 parent 91d74de commit 3a14709
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions marketplace/services/vtex/generic_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Check warning on line 160 in marketplace/services/vtex/generic_service.py

View check run for this annotation

Codecov / codecov/patch

marketplace/services/vtex/generic_service.py#L160

Added line #L160 was not covered by tests
self.app_manager.initial_sync_products_completed(catalog.vtex_app)
return products

Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 3a14709

Please sign in to comment.