apollo_config_manager: add sender channel to the config manager runner#13477
apollo_config_manager: add sender channel to the config manager runner#13477ArniStarkware wants to merge 1 commit intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
28fcbd5 to
b4eb1e5
Compare
b4eb1e5 to
65e2e26
Compare
65e2e26 to
4973804
Compare
4973804 to
f157278
Compare
7d39183 to
8868d60
Compare
f157278 to
1a4208c
Compare
8868d60 to
00e3f97
Compare
nadin-Starkware
left a comment
There was a problem hiding this comment.
@nadin-Starkware reviewed 3 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ArniStarkware).
crates/apollo_config_manager/src/config_manager_runner.rs line 150 at r1 (raw file):
// block. match self.dynamic_config_tx.send(node_dynamic_config.clone()) { Ok(()) => info!("Successfully sent node dynamic config to the channel"),
Please change it to debug
Code quote:
infocrates/apollo_config_manager/src/config_manager_runner.rs line 158 at r1 (raw file):
match self .config_manager_client .set_node_dynamic_config(node_dynamic_config.clone())
Please remove
Code quote:
clone()crates/apollo_node/src/components.rs line 164 at r1 (raw file):
.expect("Config Manager config should be set"); // TODO(Arni): remove the config_manager. let config_manger =
Please fix the typo
Suggestion:
config_manager00e3f97 to
3be4b39
Compare
1a4208c to
259f73a
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 3 comments.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on nadin-Starkware).
crates/apollo_config_manager/src/config_manager_runner.rs line 150 at r1 (raw file):
Previously, nadin-Starkware (Nadin Jbara) wrote…
Please change it to debug
Done.
crates/apollo_config_manager/src/config_manager_runner.rs line 158 at r1 (raw file):
Previously, nadin-Starkware (Nadin Jbara) wrote…
Please remove
Done. Note, this changes the return type of this function. Luckily, the return value of this function was never used.
crates/apollo_node/src/components.rs line 164 at r1 (raw file):
Previously, nadin-Starkware (Nadin Jbara) wrote…
Please fix the typo
Done.
3be4b39 to
5046eba
Compare
259f73a to
ac8af19
Compare
nadin-Starkware
left a comment
There was a problem hiding this comment.
@nadin-Starkware reviewed 3 files and all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArniStarkware).
ac8af19 to
65bfb02
Compare
5046eba to
2b86e25
Compare
1cfe58b to
a93365a
Compare
dac3698 to
27d4ea6
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 2 comments.
send_if_modified — done, switched to send_if_modified.
Test comment — the comment is still relevant at this PR level. set_node_dynamic_config exists here and is called by the runner. It's only removed in the downstream remove_client_from_runner PR. The note warns that we don't validate the correct config is passed — that validation would require .withf() on the mock, which isn't worth adding since the method is removed shortly downstream.
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 3 comments.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on Itay-Tsabary-Starkware and nadin-Starkware).
crates/apollo_config_manager/src/config_manager_runner.rs line 37 at r3 (raw file):
Previously, nadin-Starkware (Nadin Jbara) wrote…
Please rename to
_dynamic_config_rx
Done.
crates/apollo_config_manager/src/config_manager_runner.rs line 137 at r3 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
This entire logic can be very-much simplified by using https://docs.rs/tokio/latest/tokio/sync/watch/struct.Sender.html#method.send_if_modified
Done.
crates/apollo_config_manager/src/config_manager_runner_tests.rs line 128 at r3 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Still relevant? Isn't that method removed?
The method set_node_dynamic_config has been removed upstream. This is why the comment states: "This method is soon to be replaced."
27d4ea6 to
71aaca7
Compare
a93365a to
f70ab5a
Compare
71aaca7 to
97319e3
Compare
97319e3 to
717f753
Compare
nadin-Starkware
left a comment
There was a problem hiding this comment.
@nadin-Starkware made 1 comment and resolved 1 discussion.
Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on Itay-Tsabary-Starkware).
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 3 comments and resolved 2 discussions.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on ArniStarkware and nadin-Starkware).
crates/apollo_config_manager/src/config_manager_runner.rs line 142 at r7 (raw file):
let changed = self.dynamic_config_tx.send_if_modified(|current| { if *current == node_dynamic_config {
Does it make sense to compare the references here? That is,
current == &node_dynamic_config
Code quote:
if *current == node_dynamic_configcrates/apollo_config_manager/src/config_manager_runner.rs line 146 at r7 (raw file):
} Self::log_config_diff(current, &node_dynamic_config); *current = node_dynamic_config.clone();
Please add a todo to remove this clone, I suspect it is currently required only due to the about-to-be-removed block at the end.
Code quote:
.clone();crates/apollo_config_manager/src/config_manager_runner.rs line 182 at r7 (raw file):
info!("ConfigManagerRunner: {key} changed from {old_value} to {new_value}"); } }
Is there a reason for this function to be a part of the struct's impl block?
Code quote:
fn log_config_diff(old_config: &NodeDynamicConfig, new_config: &NodeDynamicConfig) {
let old_config = get_config_presentation(old_config, false).unwrap();
let new_config = get_config_presentation(new_config, false).unwrap();
let all_keys: BTreeSet<_> = old_config
.as_object()
.unwrap()
.keys()
.chain(new_config.as_object().unwrap().keys())
.collect();
for key in all_keys {
let old_value = old_config.as_object().unwrap().get(key).unwrap_or(&Value::Null);
let new_value = new_config.as_object().unwrap().get(key).unwrap_or(&Value::Null);
if old_value != new_value {
info!("ConfigManagerRunner: {key} changed from {old_value} to {new_value}");
}
}4c2a99f to
0c934fc
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 3 comments.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on Itay-Tsabary-Starkware and nadin-Starkware).
crates/apollo_config_manager/src/config_manager_runner.rs line 142 at r7 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Does it make sense to compare the references here? That is,
current == &node_dynamic_config
Done.
crates/apollo_config_manager/src/config_manager_runner.rs line 146 at r7 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Please add a todo to remove this
clone, I suspect it is currently required only due to the about-to-be-removed block at the end.
Done.
crates/apollo_config_manager/src/config_manager_runner.rs line 182 at r7 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Is there a reason for this function to be a part of the
struct'simplblock?
Done.
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware reviewed 3 files and all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on nadin-Starkware).
0c934fc to
35c4ba3
Compare
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 2d54569. Bugbot is set up for automated code reviews on this repo. Configure here. |
35c4ba3 to
2d54569
Compare

Note
Medium Risk
Touches live config reload/update flow by switching change detection to a
tokio::sync::watchchannel, which could affect when/if dynamic config updates propagate. Still calls the existingconfig_manager_clientupdate path, but now only after channel state changes.Overview
ConfigManagerRunnernow owns atokio::sync::watchsender/receiver pair and uses it as the source of truth for the latestNodeDynamicConfig, replacing the prior internallatest_node_dynamic_configfield.update_confignow returnsResult<()>, computes diffs against the channel’s current value viasend_if_modified, logs per-key changes through a new freelog_config_diffhelper, and only pushes updates (and callsset_node_dynamic_config) when the config actually changes. Node component wiring and runner tests are updated to create/pass the watch channel and validate updates by reading from it.Reviewed by Cursor Bugbot for commit 0c934fc. Bugbot is set up for automated code reviews on this repo. Configure here.