2011-10-27 11:38:05 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
import datetime
|
|
|
|
|
2013-02-21 13:28:36 +00:00
|
|
|
from celery.task import 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()
|