Skip to content

Commit

Permalink
fix: move webhook logs to send_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
elitonzky committed Jan 28, 2025
1 parent 44c1676 commit 967a41d
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions marketplace/wpp_products/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ def task_update_vtex_products(**kwargs):
)
return

close_old_connections()
# Webhook Log
WebhookLog.objects.create(sku_id=sku_id, data=webhook, vtex_app=vtex_app)

except Exception as e:
logger.error(
f"An error occurred during the updating Webhook vtex products for app {app_uuid}, {str(e)}"
Expand Down Expand Up @@ -380,6 +376,9 @@ def send_sync(app_uuid: str, webhook: dict):
# Check if the app uses specific queue
celery_queue = app.config.get("celery_queue_name", "product_synchronization")

# Webhook Log
WebhookLog.objects.create(sku_id=sku_id, data=webhook, vtex_app=app)

Check warning on line 380 in marketplace/wpp_products/tasks.py

View check run for this annotation

Codecov / codecov/patch

marketplace/wpp_products/tasks.py#L380

Added line #L380 was not covered by tests

if use_sync_v2:
logger.info(f"App {app_uuid} uses Sync v2. Enqueuing for batch update.")

Expand Down Expand Up @@ -563,12 +562,6 @@ def task_update_batch_products(app_uuid: str, seller: str, sku_id: str):
)
return

# Log webhook after successful processing
close_old_connections()
WebhookLog.objects.create(
sku_id=sku_id, data={"IdSku": sku_id, "An": seller}, vtex_app=vtex_app
)

except Exception as e:
logger.error(
f"An error occurred during the processing of SKU: {sku_id} for App: {app_uuid}. Error: {e}"
Expand Down

0 comments on commit 967a41d

Please sign in to comment.