mirror of https://github.com/zulip/zulip.git
upload-release: Avoid appending to bytes in a loop.
Appending to bytes in a loop leads to a quadratic slowdown since Python doesn’t optimize this for bytes like it does for str. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
80e4d5436d
commit
f9271098bf
|
@ -96,14 +96,14 @@ if ordered_filenames[1] == new_basename:
|
||||||
file_hashes["zulip-server-latest.tar.gz"] = file_hashes[new_basename]
|
file_hashes["zulip-server-latest.tar.gz"] = file_hashes[new_basename]
|
||||||
|
|
||||||
print("Updating SHA256SUMS.txt..")
|
print("Updating SHA256SUMS.txt..")
|
||||||
contents = b""
|
contents = ""
|
||||||
for ordered_filename in ordered_filenames:
|
for ordered_filename in ordered_filenames:
|
||||||
# natsorted type annotation is insufficiently generic
|
# natsorted type annotation is insufficiently generic
|
||||||
assert isinstance(ordered_filename, str)
|
assert isinstance(ordered_filename, str)
|
||||||
contents += f"{file_hashes[ordered_filename]} {ordered_filename}\n".encode()
|
contents += f"{file_hashes[ordered_filename]} {ordered_filename}\n"
|
||||||
bucket.put_object(
|
bucket.put_object(
|
||||||
ACL="public-read",
|
ACL="public-read",
|
||||||
Body=contents,
|
Body=contents.encode(),
|
||||||
ContentType="text/plain",
|
ContentType="text/plain",
|
||||||
Key="server/SHA256SUMS.txt",
|
Key="server/SHA256SUMS.txt",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue