Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix circuit breaker wrapper for trigger_webhook_sync (#17443)

Cezary Miącza500c4e0ba24
diff --git a/saleor/webhook/circuit_breaker/breaker_board.py b/saleor/webhook/circuit_breaker/breaker_board.py
index 36160f36ea..13d743d477 100644
--- a/saleor/webhook/circuit_breaker/breaker_board.py
+++ b/saleor/webhook/circuit_breaker/breaker_board.py
@@ -163,8 +163,8 @@ class BreakerBoard:
def __call__(self, func):
def inner(*args, **kwargs):
- event_type: str = args[0]
- webhook: Webhook = args[2]
+ event_type: str = kwargs.get("event_type") or args[0]
+ webhook: Webhook = kwargs.get("webhook") or args[2]
if event_type not in settings.BREAKER_BOARD_SYNC_EVENTS:
# Execute webhook without affecting breaker state
diff --git a/saleor/webhook/tests/circuit_breaker/test_breaker_board_decorator.py b/saleor/webhook/tests/circuit_breaker/test_breaker_board_decorator.py
index 39e60a4671..fd3e9394a6 100644
--- a/saleor/webhook/tests/circuit_breaker/test_breaker_board_decorator.py
+++ b/saleor/webhook/tests/circuit_breaker/test_breaker_board_decorator.py
@@ -30,7 +30,10 @@ def test_breaker_board(
new=Mock(return_value=expected_data),
):
response_data = transport.trigger_webhook_sync(
- WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT, "", webhook, True
+ event_type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ payload="",
+ webhook=webhook,
+ allow_replica=True,
)
state = breaker_board.update_breaker_state(webhook.app)