You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
from logging import getLogger
|
|
|
|
from django.conf import settings
|
|
|
|
from huey import crontab
|
|
|
|
from huey.contrib.djhuey import periodic_task
|
|
|
|
from items.tasks.common import get_items_past_days
|
|
|
|
|
|
|
|
|
|
|
|
logger = getLogger('django.server')
|
|
|
|
|
|
|
|
@periodic_task(crontab(minute='0', hour='0', day='*'))
|
|
|
|
def delete_expired_items():
|
|
|
|
expired_days = settings.ESCROW_PERIOD_DAYS
|
|
|
|
items = get_items_past_days(expired_days)
|
|
|
|
for item in items:
|
|
|
|
logger.info(f'[INFO] Found expired item #{item.id} (older than {expired_days} days).')
|
|
|
|
item.delete()
|