From 77b9b0c3eb5a98b35224e16fd4594226be79cbb5 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Tue, 28 Feb 2023 13:24:42 +0100 Subject: [PATCH] fix: Client features were not refreshing. (#79) We incorrectly assumed that our merge method would be enough here, but since the merge method retained the original and deduped, it seems like we tricked ourselves. The fix reduces the action to simply replacing whatever was cached with the newly fetched features from the server --- server/src/data_sources/memory_provider.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/src/data_sources/memory_provider.rs b/server/src/data_sources/memory_provider.rs index 87d24e7a..cdb980f6 100644 --- a/server/src/data_sources/memory_provider.rs +++ b/server/src/data_sources/memory_provider.rs @@ -4,7 +4,6 @@ use actix_web::http::header::EntityTag; use async_trait::async_trait; use dashmap::DashMap; use unleash_types::client_features::ClientFeatures; -use unleash_types::Merge; use super::repository::{DataSink, DataSource}; @@ -77,12 +76,7 @@ impl DataSink for MemoryProvider { } async fn sink_features(&self, token: &EdgeToken, features: ClientFeatures) -> EdgeResult<()> { - self.data_store - .entry(key(token)) - .and_modify(|data| { - *data = data.clone().merge(features.clone()); - }) - .or_insert(features); + self.data_store.insert(key(token), features); Ok(()) }