wrap payout code in try/except block

revamp
lza_menace 3 years ago
parent e908aaceda
commit af87610e60

@ -117,19 +117,20 @@ def payout_users():
_fa = wownero.from_atomic _fa = wownero.from_atomic
_aw = wownero.as_wownero _aw = wownero.as_wownero
for post in Post.select(): for post in Post.select():
submitter = Profile.get(username=post.submitter) try:
balances = wallet.balances(post.account_index) submitter = Profile.get(username=post.submitter)
url = url_for('post.read', id=post.id, _external=True) balances = wallet.balances(post.account_index)
if balances[1] > 0.1: url = url_for('post.read', id=post.id, _external=True)
print(f"Post #{post.id} has {balances[1]} funds unlocked and ready to send. Sweeping all funds to user's address ({submitter.address}).") if balances[1] > 0.05:
sweep = wallet.sweep_all(account=post.account_index, dest_address=submitter.address) print(f"Post #{post.id} has {balances[1]} funds unlocked and ready to send. Sweeping all funds to user's address ({submitter.address}).")
print(sweep) sweep = wallet.sweep_all(account=post.account_index, dest_address=submitter.address)
if "tx_hash_list" in sweep: print(sweep)
amount = 0 if "tx_hash_list" in sweep:
for amt in sweep["amount_list"]: amount = 0
amount += int(amt) for amt in sweep["amount_list"]:
# post_webhook(f"Paid out :moneybag: {_aw(_fa(amount))} WOW to `{post.submitter}` for post [{post.id}]({url})") amount += int(amt)
# god damn you eimernase, why'd you ruin this for me? :P except Exception as e:
print(f"Failed because: {e}")
@app.cli.command("add_admin") @app.cli.command("add_admin")
@click.argument("username") @click.argument("username")

Loading…
Cancel
Save