From 351386df82de632ffa26af35fe00d5bac3e1b78e Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 2 Oct 2011 17:39:49 +0200 Subject: [PATCH] speedup rebuildcache --- pandora/item/management/commands/rebuildcache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora/item/management/commands/rebuildcache.py b/pandora/item/management/commands/rebuildcache.py index a3f2417f..570b30af 100644 --- a/pandora/item/management/commands/rebuildcache.py +++ b/pandora/item/management/commands/rebuildcache.py @@ -20,8 +20,8 @@ class Command(BaseCommand): def handle(self, **options): offset = 0 chunk = 100 - pos = models.Item.objects.count() - while offset <= models.Item.objects.count(): + 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 i.save()