From 584a4be4f25775dfdac3375e338b45a5200a851f Mon Sep 17 00:00:00 2001 From: Sanskar Jaiswal Date: Sat, 5 Aug 2023 16:08:32 +0530 Subject: [PATCH] make `controller::Config::debounce()` a builder Signed-off-by: Sanskar Jaiswal --- kube-runtime/src/controller/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kube-runtime/src/controller/mod.rs b/kube-runtime/src/controller/mod.rs index 50564ca83..8f3599f29 100644 --- a/kube-runtime/src/controller/mod.rs +++ b/kube-runtime/src/controller/mod.rs @@ -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 } } @@ -1331,8 +1332,6 @@ mod tests { let (queue_tx, queue_rx) = futures::channel::mpsc::unbounded::>(); 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 { @@ -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 {