feat(automatic-exchange-rate): track unsuccessful runs

This commit is contained in:
Herculino Trotta
2026-01-10 14:10:21 -03:00
parent b074ef7929
commit 50e5492ea1
6 changed files with 144 additions and 4 deletions
@@ -1,5 +1,4 @@
import logging
from datetime import timedelta
from django.db.models import QuerySet
from django.utils import timezone
@@ -258,7 +257,10 @@ class ExchangeRateFetcher:
processed_pairs.add((from_currency.id, to_currency.id))
service.last_fetch = timezone.now()
service.failure_count = 0
service.save()
except Exception as e:
logger.error(f"Error fetching rates for {service.name}: {e}")
service.failure_count += 1
service.save()