pandora/pandora/app/tasks.py

15 lines
451 B
Python
Raw Normal View History

2011-10-27 11:38:05 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import datetime
2011-12-27 13:21:22 +00:00
from celery.task import task, periodic_task
2012-01-27 12:41:28 +00:00
from celery.schedules import crontab
2011-10-27 11:38:05 +00:00
@periodic_task(run_every=crontab(hour=6, minute=0), queue='encoding')
def cron(**kwargs):
from django.db import transaction
from django.contrib.sessions.models import Session
Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
transaction.commit_unless_managed()