fix: handle exceptions in xmr data logging
Some checks are pending
Docker / build (push) Waiting to run

Added a try-except block when printing XMR-related data to handle potential exceptions such as missing social data or uninitialized variables. This prevents the application from crashing due to `Social.DoesNotExist` or `UnboundLocalError`, enhancing robustness and ensuring smoother operation.
This commit is contained in:
Kumi 2024-11-13 16:18:33 +01:00
parent 250061876c
commit 831867dfb1
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -795,17 +795,21 @@ def update_database(date_from=None, date_to=None):
data.crypto_postsPerHour = 0 data.crypto_postsPerHour = 0
data.save() data.save()
print(
str(coin_xmr.supply) try:
+ " xmr " print(
+ str(data.xmr_subscriberCount) str(coin_xmr.supply)
+ " - " + " xmr "
+ str(social_xmr.subscriberCount) + str(data.xmr_subscriberCount)
+ " = " + " - "
+ str(int(data.xmr_marketcap)) + str(social_xmr.subscriberCount)
+ " => " + " = "
+ str(coin_xmr.inflation) + str(int(data.xmr_marketcap))
) + " => "
+ str(coin_xmr.inflation)
)
except (Social.DoesNotExist, UnboundLocalError):
pass
count += 1 count += 1