From 94a4708df7db63bc8dc454744739cee2d371714b Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 29 Oct 2014 09:12:04 +0100 Subject: [PATCH] Using iterqueryset in management command --- .../notifications/management/commands/send_notifications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/taiga/projects/notifications/management/commands/send_notifications.py b/taiga/projects/notifications/management/commands/send_notifications.py index 74c9bf31..4f2e4643 100644 --- a/taiga/projects/notifications/management/commands/send_notifications.py +++ b/taiga/projects/notifications/management/commands/send_notifications.py @@ -17,11 +17,13 @@ from django.core.management.base import BaseCommand +from taiga.base.utils.iterators import iter_queryset from taiga.projects.notifications.models import HistoryChangeNotification from taiga.projects.notifications.services import send_sync_notifications class Command(BaseCommand): def handle(self, *args, **options): - for change_notification in HistoryChangeNotification.objects.all(): + qs = HistoryChangeNotification.objects.all() + for change_notification in iter_queryset(qs, itersize=100): send_sync_notifications(change_notification.pk)