Skip to content

Commit 4d29913

Browse files
committed
refactor: Run all futures concurrently, exit on error
1 parent 3b64e51 commit 4d29913

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

rust/operator-binary/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crd::{
88
APP_NAME, OPERATOR_NAME, ZookeeperCluster, ZookeeperClusterVersion, ZookeeperZnode,
99
ZookeeperZnodeVersion, v1alpha1,
1010
};
11-
use futures::{StreamExt, pin_mut};
11+
use futures::StreamExt;
1212
use stackable_operator::{
1313
YamlSchema,
1414
cli::{Command, RunArguments},
@@ -220,10 +220,12 @@ async fn main() -> anyhow::Result<()> {
220220
},
221221
);
222222

223-
pin_mut!(zk_controller, znode_controller);
224223
// kube-runtime's Controller will tokio::spawn each reconciliation, so this only concerns the internal watch machinery
225-
let controller_futures = futures::future::select(zk_controller, znode_controller);
226-
tokio::join!(controller_futures, eos_checker);
224+
tokio::select! {
225+
_ = zk_controller => {},
226+
_ = znode_controller => {},
227+
_ = eos_checker => {}
228+
}
227229
}
228230
}
229231

0 commit comments

Comments
 (0)