use oxtimelines

This commit is contained in:
j 2012-05-17 11:38:59 +02:00
commit 96ec35e51a
19 changed files with 393 additions and 164 deletions

View file

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from os.path import join, dirname, basename, splitext, exists
import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
import monkey_patch.models
from ... import models
class Command(BaseCommand):
"""
rebuild timeline for all items.
"""
help = 'rebuild all timeines(use after updating oxtimelines)'
args = ''
def handle(self, **options):
offset = 0
chunk = 50
count = pos = models.Item.objects.count()
while offset <= count:
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
print pos, i.itemId
for s in i.streams():
s.make_timeline()
i.update_timeline()
pos -= 1
offset += chunk
time.sleep(30) #keep load down

View file

@ -16,7 +16,8 @@ class Command(BaseCommand):
"""
rebuild sort/search cache for all items.
"""
help = 'listen to rabbitmq and execute encoding tasks.'
help = 'rebuild sort/search cache for all items.'
"""
args = ''
def handle(self, **options):