Skip to content

Commit

Permalink
Clean up code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Breno Tostes committed Dec 3, 2023
1 parent 8524a5b commit 29a7b9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions backend/app/app/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
app.config_from_object("django.conf:settings", namespace="CELERY")


@app.task
def app_task():
return "App task called."
# @app.task
# def app_task():
# return "App task called."


app.autodiscover_tasks()
6 changes: 3 additions & 3 deletions backend/app/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def sample_task():
@shared_task
def update_db_task():
"""Task for updating Assets on db."""

# Evokes django admin command for updating db
call_command('initialize_db')

Expand All @@ -38,7 +37,7 @@ def check_tunnel_thresholds_task():

for tunnel in Tunnel.objects.all():
if (now - tunnel.lastChecked) >= timedelta(minutes=tunnel.interval):
print(f"Checking {tunnel.assetId} for {tunnel.userId}.")
logger.info(f"Checking {tunnel.assetId} for {tunnel.userId}.")
if tunnel.assetId.value > tunnel.upperVal:
send_mail_task.delay(
user=tunnel.userId.email,
Expand Down Expand Up @@ -74,7 +73,8 @@ def send_mail_task(user, username, ticker, action, curr_value, set_value):
{action} is advised!
"""
print(f"Sending email to {user}")

logger.info(f"Sending email to {user}.")
send_mail(
subject=mail_sbj,
message=msg,
Expand Down

0 comments on commit 29a7b9b

Please sign in to comment.