Skip to content

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

Drop the log indicating the mismatch of code usage (#17585)

Iga Karbowiakd4fcbd22a853
diff --git a/saleor/order/tasks.py b/saleor/order/tasks.py
index dc5a3c5ae0..ff000fe22b 100644
--- a/saleor/order/tasks.py
+++ b/saleor/order/tasks.py
@@ -78,15 +78,6 @@ def _bulk_release_voucher_usage(order_ids):
Exists(vouchers.filter(id=OuterRef("voucher_id"))),
).annotate(order_count=Subquery(count_orders))
- # We observed mismatch between code.used and number of orders which utilize the code
- # In some cases it is expected, but we want to further investigate the issue
- suspected_codes = [code.code for code in codes if code.used < code.order_count]
- if suspected_codes:
- logger.error(
- "Voucher codes: [%s] have been used more times than indicated by `code.used` field.",
- ",".join(suspected_codes),
- )
-
codes.update(used=Greatest(F("used") - F("order_count"), 0))
orders = Order.objects.filter(id__in=order_ids)
diff --git a/saleor/order/tests/test_tasks.py b/saleor/order/tests/test_tasks.py
index 821253c7c5..331f6b3c32 100644
--- a/saleor/order/tests/test_tasks.py
+++ b/saleor/order/tests/test_tasks.py
@@ -1,5 +1,4 @@
import datetime
-import logging
from unittest import mock
from unittest.mock import call, patch
@@ -707,7 +706,7 @@ def test_delete_expired_orders_task_schedule_itself(
def test_bulk_release_voucher_usage_voucher_usage_mismatch(
- order_list, allocations, channel_USD, voucher_customer, caplog
+ order_list, allocations, channel_USD, voucher_customer
):
# We can have mismatch between `voucher.used` and number of order utilizing
# the voucher. It can happen in following cases:
@@ -744,7 +743,6 @@ def test_bulk_release_voucher_usage_voucher_usage_mismatch(
channel_USD.save()
now = timezone.now()
- caplog.set_level(logging.ERROR)
code = voucher_customer.voucher_code
voucher = code.voucher
code.used = 1
@@ -770,7 +768,6 @@ def test_bulk_release_voucher_usage_voucher_usage_mismatch(
# then
code.refresh_from_db()
assert code.used == 0
- assert code.code in caplog.text
@patch(