feat: add cancellation

This commit is contained in:
2026-01-12 12:07:04 +01:00
parent c0f06beb4d
commit 514b6ab333
3 changed files with 11 additions and 4 deletions

View File

@@ -38,11 +38,18 @@ impl<TOperator: Operator> ControlPlane<TOperator> {
self
}
pub async fn execute(&self) -> anyhow::Result<()> {
self.execute_with_cancellation(CancellationToken::new())
.await
}
pub async fn execute_with_cancellation(
&self,
cancellation: CancellationToken,
) -> anyhow::Result<()> {
tracing::info!(worker_id = %self.worker_id, "starting control plane");
let cancellation_token = CancellationToken::new();
let cancellation_token = cancellation;
let child_token = cancellation_token.child_token();
if let Some(deadline) = self.deadline {
tokio::spawn(async move {