Skip to content

Commit

Permalink
fix: Client features were not refreshing. (#79)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christopher Kolstad authored Feb 28, 2023
1 parent 60bcf76 commit 77b9b0c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions server/src/data_sources/memory_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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(())
}

Expand Down

0 comments on commit 77b9b0c

Please sign in to comment.