mirror of https://github.com/zulip/zulip.git
populate_db: Make num_recips calculation more clear.
Extracting this calculation makes it easier to hack it when you're trying to load lots of users. We probably want a slightly more realistic calculation here for stress testing. And also fewer rows. But at least now it's a little more clear what it's doing.
This commit is contained in:
parent
4a8c70593f
commit
6a9eaebff2
|
@ -335,10 +335,14 @@ class Command(BaseCommand):
|
|||
r = Recipient.objects.get(type=Recipient.STREAM, type_id=stream.id)
|
||||
subscriptions_list.append((profile, r))
|
||||
else:
|
||||
num_streams = len(recipient_streams)
|
||||
num_users = len(profiles)
|
||||
for i, profile in enumerate(profiles):
|
||||
# Subscribe to some streams.
|
||||
for type_id in recipient_streams[:int(len(recipient_streams) *
|
||||
float(i)/len(profiles)) + 1]:
|
||||
fraction = float(i) / num_users
|
||||
num_recips = int(num_streams * fraction) + 1
|
||||
|
||||
for type_id in recipient_streams[:num_recips]:
|
||||
r = Recipient.objects.get(type=Recipient.STREAM, type_id=type_id)
|
||||
subscriptions_list.append((profile, r))
|
||||
|
||||
|
|
Loading…
Reference in New Issue