Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache invalidation for the get_cached_seat_count function #29758

Open
mateuszmandera opened this issue Apr 16, 2024 · 1 comment
Open

Add cache invalidation for the get_cached_seat_count function #29758

mateuszmandera opened this issue Apr 16, 2024 · 1 comment

Comments

@mateuszmandera
Copy link
Contributor

mateuszmandera commented Apr 16, 2024

#29258 added get_cached_seat_count which calculates and caches the number of seats being used by a Zulip Cloud organization, used for the purposes of calculating the upload storage limit (5GB/seat). Currently this cache is for 24h and nothing invalidates it, meaning an up to 24h lag between adding/removing users and the limit getting updated.

As noted in #29258 (comment) this is reasonable-ish behavior, but it's better to follow-up and add cache invalidation in the right places:

I think the callers of realm_user_count_by_role would be the right set -- so basically what you mentioned plus the role-change code path, for users switching between guests and not. Could consider changing maybe_enqueue_audit_log_upload to have a more general name like process_realm_license_count_change and do this cache flush also. Could imagine having that accept the audit log event type and do the RealmAuditLog.objects.create as well.

@zulipbot
Copy link
Member

Hello @zulip/server-misc members, this issue was labeled with the "area: uploads" label, so you may want to check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants