mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Fixes #18915 This was very slow, causing performance issues. After investigating, generate_presigned_url is the cheap part of this, but the session.client() call is expensive - so that's what we should cache. Before the change: ``` In [4]: t = time.time() ...: for i in range(250): ...: x = u.get_public_upload_url("foo") ...: print(time.time()-t) 6.408717393875122 ``` After: ``` In [4]: t = time.time() ...: for i in range(250): ...: x = u.get_public_upload_url("foo") ...: print(time.time()-t) 0.48990607261657715 ``` This is not good enough to avoid doing something ugly like replacing generate_presigned_url with some manual URL manipulation, but it's a helpful structure that we may find useful with further refactoring.
36 KiB
36 KiB