Skip to content

Commit

Permalink
feat(notification): cronify task send_notifs_when_following_replies
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Jun 22, 2023
1 parent 8429a29 commit ebddab5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions clevercloud/cron.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"0 5 * * * $ROOT/clevercloud/collect_daily_matomo_stats.sh",
"5 5 1 * * $ROOT/clevercloud/collect_monthly_matomo_stats.sh",
"5 7-21 * * * $ROOT/clevercloud/send_notifs_when_first_reply.sh",
"5 19 * * * $ROOT/clevercloud/send_notifs_when_following_replies.sh",
"10 6-22 * * * $ROOT/clevercloud/add_user_to_list_when_register.sh",
"30 13 * * 1 $ROOT/clevercloud/send_notifs_on_unanswered_topics_list.sh 8",
"30 13 * * 2 $ROOT/clevercloud/send_notifs_on_unanswered_topics_list.sh 9",
Expand Down
18 changes: 18 additions & 0 deletions clevercloud/send_notifs_when_following_replies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -l

# Collect Daily Matomo Stats

#
# About clever cloud cronjobs:
# https://www.clever-cloud.com/doc/tools/crons/
#

if [[ "$INSTANCE_NUMBER" != "0" ]]; then
echo "Instance number is ${INSTANCE_NUMBER}. Stop here."
exit 0
fi

# $APP_HOME is set by default by clever cloud.
cd $APP_HOME

python manage.py send_notifs_when_following_replies
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand

from lacommunaute.notification.tasks import send_notifs_on_following_replies


class Command(BaseCommand):
help = "Envoyer une notification par email à l'auteur d'un sujet quand il y a de nouvelles réponses"

def handle(self, *args, **options):
send_notifs_on_following_replies()
self.stdout.write(self.style.SUCCESS("That's all, folks!"))

0 comments on commit ebddab5

Please sign in to comment.