Skip to content

Commit

Permalink
fix(propdefs): fix group-type caching (#24928)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverb123 authored Sep 12, 2024
1 parent e6a76ee commit 9580ac6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rust/property-defs-rs/src/app_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct AppContext {
pub cache_warming_cutoff: f64,
pub skip_writes: bool,
pub skip_reads: bool,
pub group_type_cache: Cache<String, i32>,
pub group_type_cache: Cache<String, i32>, // Keyed on group-type name, and team id
}

impl AppContext {
Expand Down Expand Up @@ -96,7 +96,9 @@ impl AppContext {
continue;
};

let cached = self.group_type_cache.get(name);
let name = format!("{}:{}", update.team_id, name);

let cached = self.group_type_cache.get(&name);
if let Some(index) = cached {
update.group_type_index =
update.group_type_index.take().map(|gti| gti.resolve(index));
Expand All @@ -114,7 +116,7 @@ impl AppContext {
.await?;

if let Some(index) = found {
self.group_type_cache.insert(name.to_string(), index);
self.group_type_cache.insert(name, index);
update.group_type_index =
update.group_type_index.take().map(|gti| gti.resolve(index));
} else {
Expand Down

0 comments on commit 9580ac6

Please sign in to comment.