upload: Remove common cache from get_export_tarball_url.

This is not called in the hot path like get_avatar_url is.
This commit is contained in:
Alex Vandiver 2022-04-06 16:50:23 -07:00 committed by Tim Abbott
parent a5bf452202
commit 4cf835d9dd
1 changed files with 12 additions and 2 deletions

View File

@ -415,8 +415,18 @@ class S3UploadBackend(ZulipUploadBackend):
@override
def get_export_tarball_url(self, realm: Realm, export_path: str) -> str:
# export_path has a leading /
return self.get_public_upload_url(export_path.removeprefix("/"))
client = self.avatar_bucket.meta.client
signed_url = client.generate_presigned_url(
ClientMethod="get_object",
Params={
"Bucket": self.avatar_bucket.name,
# export_path has a leading /
"Key": export_path.removeprefix("/"),
},
ExpiresIn=0,
)
# Strip off the signing query parameters, since this URL is public
return urlsplit(signed_url)._replace(query="").geturl()
@override
def upload_export_tarball(