trying to fix logging
This commit is contained in:
@ -66,19 +66,19 @@ def sql_script(f, c):
|
||||
def cron_task():
|
||||
|
||||
# make sure btcpay payments get completed (in case we miss a webhook), otherwise invalidate the payment
|
||||
print("cron_task: starting clean_up_unresolved_btcpay_invoices")
|
||||
current_app.logger.info("cron_task: starting clean_up_unresolved_btcpay_invoices")
|
||||
clean_up_unresolved_btcpay_invoices()
|
||||
print("cron_task: finished clean_up_unresolved_btcpay_invoices")
|
||||
current_app.logger.info("cron_task: finished clean_up_unresolved_btcpay_invoices")
|
||||
|
||||
# notify when funds run out
|
||||
print("cron_task: starting notify_users_about_account_balance")
|
||||
current_app.logger.info("cron_task: starting notify_users_about_account_balance")
|
||||
notify_users_about_account_balance()
|
||||
print("cron_task: finished notify_users_about_account_balance")
|
||||
current_app.logger.info("cron_task: finished notify_users_about_account_balance")
|
||||
|
||||
# make sure vm system and DB are synced
|
||||
print("cron_task: starting ensure_vms_and_db_are_synced")
|
||||
current_app.logger.info("cron_task: starting ensure_vms_and_db_are_synced")
|
||||
ensure_vms_and_db_are_synced()
|
||||
print("cron_task: finished ensure_vms_and_db_are_synced")
|
||||
current_app.logger.info("cron_task: finished ensure_vms_and_db_are_synced")
|
||||
|
||||
|
||||
|
||||
@ -90,13 +90,13 @@ def clean_up_unresolved_btcpay_invoices():
|
||||
days = float((datetime.now() - unresolved_invoice['created']).total_seconds())/float(60*60*24)
|
||||
|
||||
if btcpay_invoice['status'] == "complete":
|
||||
print(
|
||||
current_app.logger.info(
|
||||
f"resolving btcpay invoice {invoice_id} "
|
||||
f"({unresolved_invoice['email']}, ${unresolved_invoice['dollars']}) as completed "
|
||||
)
|
||||
get_model().btcpay_invoice_resolved(invoice_id, True)
|
||||
elif days >= 1:
|
||||
print(
|
||||
current_app.logger.info(
|
||||
f"resolving btcpay invoice {invoice_id} "
|
||||
f"({unresolved_invoice['email']}, ${unresolved_invoice['dollars']}) as invalidated, "
|
||||
f"btcpay server invoice status: {btcpay_invoice['status']}"
|
||||
@ -224,7 +224,7 @@ def notify_users_about_account_balance():
|
||||
index_to_send = i
|
||||
|
||||
if index_to_send > -1:
|
||||
print(f"cron_task: sending {warnings[index_to_send]['id']} warning email to {account['email']}.")
|
||||
current_app.logger.info(f"cron_task: sending {warnings[index_to_send]['id']} warning email to {account['email']}.")
|
||||
get_body = warnings[index_to_send]['get_body']
|
||||
get_subject = warnings[index_to_send]['get_subject']
|
||||
current_app.config["FLASK_MAIL_INSTANCE"].send(
|
||||
@ -237,7 +237,7 @@ def notify_users_about_account_balance():
|
||||
get_model().set_account_balance_warning(account['email'], warnings[index_to_send]['id'])
|
||||
if index_to_send == len(warnings)-1:
|
||||
for vm in vms:
|
||||
print(f"cron_task: deleting {vm['id']} ( {account['email']} ) due to negative account balance.")
|
||||
current_app.logger.warning(f"cron_task: deleting {vm['id']} ( {account['email']} ) due to negative account balance.")
|
||||
current_app.config["VIRTUALIZATION_MODEL"].destroy(email=account["email"], id=vm['id'])
|
||||
get_model().delete_vm(email=account["email"], id=vm['id'])
|
||||
|
||||
|
Reference in New Issue
Block a user