mirror of https://github.com/zulip/zulip.git
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:
parent
2ad1b14f23
commit
cf31374497
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue