@badpenny.periodic_task(seconds=TASK_TIME_OUT)
def cleanup_old_tasks(job_status):
    'delete any tracker task if it is older than the time a task can live for.'
    session = current_app.db.session('relengapi')
    expiry_cutoff = (now() - datetime.timedelta(seconds=TASK_TIME_OUT))
    table = tables.ArchiverTask
    for tracker in session.query(table).order_by(table.created_at):
        if (tracker.created_at < expiry_cutoff):
            delete_tracker(tracker)
        else:
            break
delete any tracker task if it is older than the time a task can live for.
@badpenny.periodic_task(seconds=TASK_TIME_OUT)
def cleanup_old_tasks(job_status):
    
    session = current_app.db.session('relengapi')
    expiry_cutoff = (now() - datetime.timedelta(seconds=TASK_TIME_OUT))
    table = tables.ArchiverTask
    for tracker in session.query(table).order_by(table.created_at):
        if (tracker.created_at < expiry_cutoff):
            delete_tracker(tracker)
        else:
            break