fix: handle exceptions in xmr data logging
Some checks are pending
Docker / build (push) Waiting to run
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:
parent
250061876c
commit
831867dfb1
1 changed files with 15 additions and 11 deletions
|
@ -795,17 +795,21 @@ def update_database(date_from=None, date_to=None):
|
|||
data.crypto_postsPerHour = 0
|
||||
|
||||
data.save()
|
||||
print(
|
||||
str(coin_xmr.supply)
|
||||
+ " xmr "
|
||||
+ str(data.xmr_subscriberCount)
|
||||
+ " - "
|
||||
+ str(social_xmr.subscriberCount)
|
||||
+ " = "
|
||||
+ str(int(data.xmr_marketcap))
|
||||
+ " => "
|
||||
+ str(coin_xmr.inflation)
|
||||
)
|
||||
|
||||
try:
|
||||
print(
|
||||
str(coin_xmr.supply)
|
||||
+ " xmr "
|
||||
+ str(data.xmr_subscriberCount)
|
||||
+ " - "
|
||||
+ str(social_xmr.subscriberCount)
|
||||
+ " = "
|
||||
+ str(int(data.xmr_marketcap))
|
||||
+ " => "
|
||||
+ str(coin_xmr.inflation)
|
||||
)
|
||||
except (Social.DoesNotExist, UnboundLocalError):
|
||||
pass
|
||||
|
||||
count += 1
|
||||
|
||||
|
|
Loading…
Reference in a new issue