Skip to content

Commit

Permalink
Allow for select remote config manager config unloading
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
  • Loading branch information
bwoebi committed Sep 25, 2024
1 parent 08a5e36 commit bb45725
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sidecar/src/shm_remote_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,20 @@ impl RemoteConfigManager {
self.check_configs.clear();
self.active_configs.clear();
}

pub fn unload_configs(&mut self, configs: &[RemoteConfigProduct]) {
self.active_configs.retain(|key, path| {
if configs.contains(&path.product) {
// self.check_configs should generally be empty here, but be safe
if let Some(pos) = self.check_configs.iter().position(|x| x == key) {
self.check_configs.swap_remove(pos);
}
false
} else {
true
}
});
}
}

#[cfg(test)]
Expand Down

0 comments on commit bb45725

Please sign in to comment.