collab: Make the StripeBilling
object long-lived (#19090)
This PR makes the `StripeBilling` object long-lived so that we can make better use of the cached data on it. We now hold it on the `AppState` and spawn a background task to initialize the cache on startup. Release Notes: - N/A Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
parent
550064f80f
commit
f280b29859
5 changed files with 129 additions and 92 deletions
|
@ -111,6 +111,13 @@ async fn main() -> Result<()> {
|
|||
|
||||
let state = AppState::new(config, Executor::Production).await?;
|
||||
|
||||
if let Some(stripe_billing) = state.stripe_billing.clone() {
|
||||
let executor = state.executor.clone();
|
||||
executor.spawn_detached(async move {
|
||||
stripe_billing.initialize().await.trace_err();
|
||||
});
|
||||
}
|
||||
|
||||
if mode.is_collab() {
|
||||
state.db.purge_old_embeddings().await.trace_err();
|
||||
RateLimiter::save_periodically(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue