From e46ea2f6f69b4b8ec183bafec8cfafc06469012d Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 28 Apr 2023 14:57:04 +0200 Subject: [PATCH] Make coordinator's `start_inner` function `Send` again The name generator uses a thread-local random number generator internally, which makes it `!Send`. So we should not keep it across await points because our `multiple_daemons` example needs to spawn it in the tokio runtime, which requires `Send`. --- binaries/coordinator/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/binaries/coordinator/src/lib.rs b/binaries/coordinator/src/lib.rs index 5215b5e9..deb9bd20 100644 --- a/binaries/coordinator/src/lib.rs +++ b/binaries/coordinator/src/lib.rs @@ -159,8 +159,6 @@ async fn start_inner( let mut archived_dataflows: HashMap = HashMap::new(); let mut daemon_connections: HashMap<_, DaemonConnection> = HashMap::new(); - let mut name_generator = names::Generator::default(); - while let Some(event) = events.next().await { if event.log() { tracing::trace!("Handling event {event:?}"); @@ -305,7 +303,7 @@ async fn start_inner( name, local_working_dir, } => { - let name = name.or_else(|| name_generator.next()); + let name = name.or_else(|| names::Generator::default().next()); let inner = async { if let Some(name) = name.as_deref() {