Skip to content

Commit 18dea86

Browse files
committed
some changes
delete store changes save changes saving Save changes again lol Save changes add round robin
1 parent ec6238d commit 18dea86

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

grpc/src/client/load_balancing/child_manager.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct ChildManager<T> {
5050
update_sharder: Box<dyn ResolverUpdateSharder<T>>,
5151
pending_work: Arc<Mutex<HashSet<usize>>>,
5252
runtime: Arc<dyn Runtime>,
53+
updated: bool,
5354
}
5455

5556
struct Child<T> {
@@ -94,6 +95,7 @@ impl<T> ChildManager<T> {
9495
children: Default::default(),
9596
pending_work: Default::default(),
9697
runtime,
98+
updated: false,
9799
}
98100
}
99101

@@ -158,8 +160,14 @@ impl<T> ChildManager<T> {
158160
// Update the tracked state if the child produced an update.
159161
if let Some(state) = channel_controller.picker_update {
160162
self.children[child_idx].state = state;
163+
self.updated = true;
161164
};
162165
}
166+
167+
/// Returns true if a child has produced an update and resets flag to false.
168+
pub fn has_updated(&mut self) -> bool {
169+
mem::take(&mut self.updated)
170+
}
163171
}
164172

165173
impl<T: PartialEq + Hash + Eq + Send + Sync + 'static> LbPolicy for ChildManager<T> {

grpc/src/client/load_balancing/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,4 @@ impl LbPolicyBuilder for StubPolicyBuilder {
276276

277277
pub fn reg_stub_policy(name: &'static str, funcs: StubPolicyFuncs) {
278278
super::GLOBAL_LB_REGISTRY.add_builder(StubPolicyBuilder { name, funcs })
279-
}
279+
}

0 commit comments

Comments
 (0)