diff --git a/proxy/src/cache/project_info.rs b/proxy/src/cache/project_info.rs index 2c834ca306..171a4fb735 100644 --- a/proxy/src/cache/project_info.rs +++ b/proxy/src/cache/project_info.rs @@ -1,4 +1,5 @@ use std::convert::Infallible; +use std::sync::Arc; use crossbeam_skiplist::SkipSet; use crossbeam_skiplist::equivalent::{Comparable, Equivalent}; @@ -27,8 +28,8 @@ pub struct ProjectInfoCache { Cache<(EndpointIdInt, RoleNameInt), ControlPlaneResult>>, ep_controls: Cache>>, - project2ep: MultiSet, - account2ep: MultiSet, + project2ep: Arc>, + account2ep: Arc>, config: ProjectInfoCacheOptions, } @@ -115,6 +116,9 @@ impl ProjectInfoCache { .capacity .set(CacheKind::ProjectInfoEndpoints, config.size as i64); + let project2ep = Arc::new(MultiSet::new()); + let account2ep = Arc::new(MultiSet::new()); + // we cache errors for 30 seconds, unless retry_at is set. let expiry = CplaneExpiry::default(); Self { @@ -136,8 +140,8 @@ impl ProjectInfoCache { .time_to_live(config.ttl) .expire_after(expiry) .build(), - project2ep: MultiSet::new(), - account2ep: MultiSet::new(), + project2ep, + account2ep, config, } }