mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
realms: Add caching to the get_seat_count calculation for upload limit.
For simiplicty's sake, we can avoid trying to do cache invalidation in the variety of events that can cause the seat count to change - since having an up to 1 day delay between users being added and the upload limit going up is quite reasonable.
This commit is contained in:
committed by
Tim Abbott
parent
066de96a86
commit
4a2a9176c2
@@ -847,11 +847,11 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
|
||||
elif plan_type == Realm.PLAN_TYPE_STANDARD_FREE:
|
||||
return Realm.UPLOAD_QUOTA_STANDARD_FREE
|
||||
elif plan_type in [Realm.PLAN_TYPE_STANDARD, Realm.PLAN_TYPE_PLUS]:
|
||||
from corporate.lib.stripe import get_seat_count
|
||||
from corporate.lib.stripe import get_cached_seat_count
|
||||
|
||||
# Paying customers with few users should get a reasonable minimum quota.
|
||||
return max(
|
||||
get_seat_count(self) * settings.UPLOAD_QUOTA_PER_USER_GB,
|
||||
get_cached_seat_count(self) * settings.UPLOAD_QUOTA_PER_USER_GB,
|
||||
Realm.UPLOAD_QUOTA_STANDARD_FREE,
|
||||
)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user