From c611d032481b03831bee9d64a60b6825d2695fc2 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Sat, 14 Oct 2023 00:48:38 +0200 Subject: [PATCH] fix: problem with bundling mutex --- crates/grpc/src/bundler.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/grpc/src/bundler.rs b/crates/grpc/src/bundler.rs index 04742bba..b7529bd9 100644 --- a/crates/grpc/src/bundler.rs +++ b/crates/grpc/src/bundler.rs @@ -89,8 +89,10 @@ where if !self.is_running() { info!("Starting auto bundling"); - let mut r = self.running.lock(); - *r = true; + { + let mut r = self.running.lock(); + *r = true; + } for bundler in self.bundlers.iter() { let bundler_own = bundler.clone(); @@ -100,10 +102,11 @@ where tokio::spawn(async move { let mut interval = tokio::time::interval(Duration::from_secs(int)); loop { + interval.tick().await; + if !is_running(running_lock.clone()) { break; } - interval.tick().await; match Self::get_user_operations( &uopool_grpc_client,