2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-01 17:41:33 +00:00

Prevent creation of duplicate backend objects

This commit is contained in:
Oliver Walters
2022-06-25 11:46:45 +10:00
parent 44b42050aa
commit 0b6d1ce86f

View File

@@ -250,13 +250,12 @@ def update_exchange_rates():
try: try:
backend = ExchangeBackend.objects.get(name='InvenTreeExchange') backend = ExchangeBackend.objects.get(name='InvenTreeExchange')
except ExchangeBackend.DoesNotExist: except ExchangeBackend.DoesNotExist:
pass backend = InvenTreeExchange()
except Exception: # pragma: no cover except Exception: # pragma: no cover
# Some other error # Some other error
logger.warning("update_exchange_rates: Database not ready") logger.warning("update_exchange_rates: Database not ready")
return return
backend = InvenTreeExchange()
logger.info(f"Updating exchange rates from {backend.url}") logger.info(f"Updating exchange rates from {backend.url}")
base = currency_code_default() base = currency_code_default()