feat: add cancellation
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user