()
Delete RequestLogs older than 90 days.
Delete RequestLogs older than 90 days.
Delete RequestLogs older than 90 days .
def delete_old_request_logs():
    """
    Delete RequestLogs older than 90 days.
    """
    ninety_days_ago = datetime.utcnow() - timedelta(days=90)
    while True:
        queryset = (RequestLog.objects
                    .filter(timestamp__lt=ninety_days_ago)
                    .values_list('id', flat=True)[:DELETE_CHUNK_SIZE])
        id_list = list(queryset)
        deleted, __ = RequestLog.objects.filter(id__in=id_list).delete()
        if not deleted:
            return
def delete_old_request_logs ( ) : ninety_days_ago = datetime . utcnow ( ) - timedelta ( days = 90 ) while True : queryset = ( RequestLog . objects . filter ( timestamp__lt = ninety_days_ago ) . values_list ( 'id' , flat = True ) [ : DELETE_CHUNK_SIZE ] ) id_list = list ( queryset ) deleted , __ = RequestLog . objects . filter ( id__in = id_list ) . delete ( ) if not deleted : return