populate_db: Remove unused `output`.

The helper function `generate_and_send_messages` receives
`self.stdout.write` from `jobs`, but it is never actually used.
This commit is contained in:
PIG208 2021-07-26 23:01:00 +08:00 committed by Tim Abbott
parent d2af20eb2a
commit 434b7e360a
1 changed files with 5 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import os
import random import random
from collections import defaultdict from collections import defaultdict
from datetime import datetime from datetime import datetime
from typing import Any, Callable, Dict, List, Mapping, Sequence, Tuple from typing import Any, Dict, List, Mapping, Sequence, Tuple
import bmemcached import bmemcached
import orjson import orjson
@ -870,14 +870,12 @@ class Command(BaseCommand):
call_command("populate_analytics_db") call_command("populate_analytics_db")
threads = options["threads"] threads = options["threads"]
jobs: List[Tuple[int, List[List[int]], Dict[str, Any], Callable[[str], int], int]] = [] jobs: List[Tuple[int, List[List[int]], Dict[str, Any], int]] = []
for i in range(threads): for i in range(threads):
count = options["num_messages"] // threads count = options["num_messages"] // threads
if i < options["num_messages"] % threads: if i < options["num_messages"] % threads:
count += 1 count += 1
jobs.append( jobs.append((count, personals_pairs, options, random.randint(0, 10 ** 10)))
(count, personals_pairs, options, self.stdout.write, random.randint(0, 10 ** 10))
)
for job in jobs: for job in jobs:
generate_and_send_messages(job) generate_and_send_messages(job)
@ -935,9 +933,9 @@ def get_recipient_by_id(rid: int) -> Recipient:
# - multiple messages per subject # - multiple messages per subject
# - both single and multi-line content # - both single and multi-line content
def generate_and_send_messages( def generate_and_send_messages(
data: Tuple[int, Sequence[Sequence[int]], Mapping[str, Any], Callable[[str], Any], int] data: Tuple[int, Sequence[Sequence[int]], Mapping[str, Any], int]
) -> int: ) -> int:
(tot_messages, personals_pairs, options, output, random_seed) = data (tot_messages, personals_pairs, options, random_seed) = data
random.seed(random_seed) random.seed(random_seed)
with open( with open(