mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Delete successful tasks more than a month old
This commit is contained in:
parent
5b8eb1c530
commit
006dd10a79
@ -6,6 +6,7 @@ import json
|
|||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from datetime import datetime, timedelta
|
||||||
from django.core.exceptions import AppRegistryNotReady
|
from django.core.exceptions import AppRegistryNotReady
|
||||||
|
|
||||||
|
|
||||||
@ -49,10 +50,16 @@ def heartbeat():
|
|||||||
def delete_successful_tasks():
|
def delete_successful_tasks():
|
||||||
"""
|
"""
|
||||||
Delete successful task logs
|
Delete successful task logs
|
||||||
which are more than a week old.
|
which are more than a month old.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
threshold = datetime.now() - timedelta(days=30)
|
||||||
|
|
||||||
|
results = Success.objects.filter(
|
||||||
|
started__lte=threshold
|
||||||
|
)
|
||||||
|
|
||||||
|
results.delete()
|
||||||
|
|
||||||
|
|
||||||
def check_for_updates():
|
def check_for_updates():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user