diff --git a/quickwit/quickwit-control-plane/src/control_plane.rs b/quickwit/quickwit-control-plane/src/control_plane.rs index f38de7a6ef1..604761e750a 100644 --- a/quickwit/quickwit-control-plane/src/control_plane.rs +++ b/quickwit/quickwit-control-plane/src/control_plane.rs @@ -54,19 +54,6 @@ pub(crate) const CONTROL_PLAN_LOOP_INTERVAL: Duration = if cfg!(any(test, featur Duration::from_secs(3) }; -/// Interval between two scheduling of indexing plans. No need to be faster than the -/// control plan loop. -// Note: it's currently not possible to define a const duration with -// `CONTROL_PLAN_LOOP_INTERVAL * number`. -pub(crate) const REFRESH_PLAN_LOOP_INTERVAL: Duration = if cfg!(any(test, feature = "testsuite")) { - Duration::from_secs(3) -} else { - Duration::from_secs(60) -}; - -#[derive(Debug)] -struct RefreshPlanLoop; - #[derive(Debug)] struct ControlPlanLoop; @@ -134,7 +121,15 @@ impl Actor for ControlPlane { .await .context("failed to initialize ingest controller")?; - self.handle(RefreshPlanLoop, ctx).await?; + if let Err(error) = self + .indexing_scheduler + .schedule_indexing_plan_if_needed() + .await + { + // TODO inspect error. + error!("Error when scheduling indexing plan: `{}`.", error); + } + ctx.schedule_self_msg(CONTROL_PLAN_LOOP_INTERVAL, ControlPlanLoop) .await; @@ -218,28 +213,6 @@ impl Handler for ControlPlane { } } -#[async_trait] -impl Handler for ControlPlane { - type Reply = (); - - async fn handle( - &mut self, - _message: RefreshPlanLoop, - ctx: &ActorContext, - ) -> Result<(), ActorExitStatus> { - if let Err(error) = self - .indexing_scheduler - .schedule_indexing_plan_if_needed() - .await - { - error!("Error when scheduling indexing plan: `{}`.", error); - } - ctx.schedule_self_msg(REFRESH_PLAN_LOOP_INTERVAL, RefreshPlanLoop) - .await; - Ok(()) - } -} - #[async_trait] impl Handler for ControlPlane { type Reply = ControlPlaneResult;