commit
3dc426a7fc
|
@ -13,6 +13,7 @@ django imports
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
|
from django.core.management import call_command
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from notification.engine import send_all
|
from notification.engine import send_all
|
||||||
from notification import models as notification
|
from notification import models as notification
|
||||||
|
@ -217,3 +218,8 @@ def notify_unclaimed_gifts():
|
||||||
if unclaimed_duration > 0 and unclaimed_duration % 7 == 0 : # first notice in 7 days
|
if unclaimed_duration > 0 and unclaimed_duration % 7 == 0 : # first notice in 7 days
|
||||||
notification.send_now([gift.acq.user], "purchase_gift_waiting", {'gift':gift}, True)
|
notification.send_now([gift.acq.user], "purchase_gift_waiting", {'gift':gift}, True)
|
||||||
notification.send_now([gift.giver], "purchase_notgot_gift", {'gift':gift}, True)
|
notification.send_now([gift.giver], "purchase_notgot_gift", {'gift':gift}, True)
|
||||||
|
|
||||||
|
@task
|
||||||
|
def periodic_cleanup():
|
||||||
|
call_command('clearsessions')
|
||||||
|
call_command('cleanupregistration')
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
from os.path import join
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
|
from celery.task import task
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.template.loader import get_template, render_to_string
|
||||||
|
|
||||||
|
from .views import InfoPageView
|
||||||
|
|
||||||
|
@task
|
||||||
|
def save_info_page():
|
||||||
|
page_view = InfoPageView()
|
||||||
|
page = render_to_string(page_view.template_name, context=page_view.get_context_data())
|
||||||
|
today = date.today().isoformat()
|
||||||
|
with open(join(settings.PROJECT_DIR, 'logs', 'metrics-%s.html' % today), 'w') as todays_metrics:
|
||||||
|
todays_metrics.write(page)
|
|
@ -414,6 +414,18 @@ NOTIFY_UNCLAIMED_GIFTS = {
|
||||||
"args": ()
|
"args": ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SAVE_INFO_PAGE = {
|
||||||
|
"task": "regluit.frontend.tasks.save_info_page",
|
||||||
|
"schedule": crontab(day_of_month='1,11,21', hour=0, minute=40),
|
||||||
|
"args": ()
|
||||||
|
}
|
||||||
|
|
||||||
|
PERIODIC_CLEANUP = {
|
||||||
|
"task": "regluit.core.tasks.periodic_cleanup",
|
||||||
|
"schedule": crontab(day_of_month='1,11,21', hour=0, minute=35),
|
||||||
|
"args": ()
|
||||||
|
}
|
||||||
|
|
||||||
# by default, in common, we don't turn any of the celerybeat jobs on -- turn them on in the local settings file
|
# by default, in common, we don't turn any of the celerybeat jobs on -- turn them on in the local settings file
|
||||||
|
|
||||||
# set notification queueing on
|
# set notification queueing on
|
||||||
|
|
Loading…
Reference in New Issue