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

cache plan name #6338

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

cache plan name #6338

wants to merge 3 commits into from

Conversation

pjain1
Copy link
Member

@pjain1 pjain1 commented Jan 2, 2025

Fixes https://github.com/rilldata/rill-private-issues/issues/973

  • Cache and update plan name on performing any subscription related action
  • Cached plan name is returned as part of GetOrganization rpc
  • GetBillingSubscription does not use cache always fetches afresh so should not be used on each page load but only on billing page
  • For handling external changes (directly done in Orb, although it should not be done), webhook are used to update the cache. They can be removed if we are ok with some staleness when external modifications are done.

@pjain1 pjain1 requested a review from begelundmuller January 2, 2025 06:26
Comment on lines +33 to +38
var planCache = make(map[string]planCacheEntry)

type planCacheEntry struct {
planDisplayName string
lastUpdated time.Time
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is updated with webhooks, it should be consistent, right? So can it be stored in Postgres instead?

It would be useful to use Postgres because a) we have multiple replicas of the admin service, b) it makes introspection easier and provides easy access to the plan name in downstream pipelines

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

Successfully merging this pull request may close these issues.

2 participants