bulk_create_streams: Fix missing select_related().

bulk_create_streams was taking about 10 seconds to run with prod data;
this should be a basically immediate operation.  The cause was a
missing select_related on one of the loops through all streams.

(imported from commit 8b82f0c41facc3999bb699dbc350708ac69797e9)
This commit is contained in:
Tim Abbott 2012-12-03 10:40:41 -05:00
parent 2ad1b14f23
commit cf31374497
1 changed files with 1 additions and 1 deletions

View File

@ -321,7 +321,7 @@ def bulk_create_streams(realms, stream_list):
batch_bulk_create(Stream, streams_to_create)
recipients_to_create = []
for stream in Stream.objects.all():
for stream in Stream.objects.select_related().all():
if (stream.realm.domain, stream.name.lower()) not in existing_streams:
recipients_to_create.append(Recipient(type_id=stream.id,
type=Recipient.STREAM))