Skip to content

Commit

Permalink
make controller::Config::debounce() a builder
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
  • Loading branch information
aryan9600 committed Aug 5, 2023
1 parent 599f5f8 commit 584a4be
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kube-runtime/src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,9 @@ impl Config {
/// This option delays (and keeps delaying) reconcile requests for objects while
/// the object is updated. It can **permanently hide** updates from your reconciler
/// if set too high on objects that are updated frequently (like nodes).
pub fn debounce(&mut self, debounce: Duration) {
pub fn debounce(mut self, debounce: Duration) -> Self {
self.debounce = debounce;
self

Check warning on line 442 in kube-runtime/src/controller/mod.rs

View check run for this annotation

Codecov / codecov/patch

kube-runtime/src/controller/mod.rs#L440-L442

Added lines #L440 - L442 were not covered by tests
}
}

Expand Down Expand Up @@ -1331,8 +1332,6 @@ mod tests {

let (queue_tx, queue_rx) = futures::channel::mpsc::unbounded::<ObjectRef<ConfigMap>>();
let (store_rx, mut store_tx) = reflector::store();
let mut config = Config::default();
config.debounce(Duration::from_millis(1));
let applier = applier(
|obj, _| {
Box::pin(async move {
Expand All @@ -1345,7 +1344,7 @@ mod tests {
Arc::new(()),
store_rx,
queue_rx.map(Result::<_, Infallible>::Ok),
config,
Config::default(),
);
pin_mut!(applier);
for i in 0..items {
Expand Down

0 comments on commit 584a4be

Please sign in to comment.