From a002b242fc13b55074ef54ff41b97040437db38c Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 30 Aug 2023 14:55:03 +0200 Subject: [PATCH] reduce barrier sync logs --- backend/windmill-worker/src/worker.rs | 40 ++++++++++++++------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index a5b3b4e33f..318b734dd9 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -506,30 +506,32 @@ pub async fn run_worker *GLOBAL_CACHE_INTERVAL && (copy_cache_from_bucket_handle.is_none() || copy_cache_from_bucket_handle.as_ref().unwrap().is_finished()) { + last_sync = Instant::now(); - tracing::debug!("CAN PULL LOCK START"); - let _lock = CAN_PULL.write().await; + if (crate::global_cache::worker_s3_bucket_sync_enabled(&db).await) { - tracing::info!("Started syncing cache"); - last_sync = Instant::now(); - // if num_workers > 1 { - // create_barrier_for_all_workers(num_workers, sync_barrier.clone()).await; - // } - if let Err(e) = copy_cache_to_tmp_cache().await { - tracing::error!("failed to copy cache to tmp cache: {}", e); - } else { - copy_cache_from_bucket_handle = Some(tokio::task::spawn(async move { - if let Some(ref s) = S3_CACHE_BUCKET.clone() { - if let Err(e) = cache_global(s, copy_tx).await { - tracing::error!("failed to sync cache: {}", e); + tracing::debug!("CAN PULL LOCK START"); + let _lock = CAN_PULL.write().await; + + tracing::info!("Started syncing cache"); + // if num_workers > 1 { + // create_barrier_for_all_workers(num_workers, sync_barrier.clone()).await; + // } + if let Err(e) = copy_cache_to_tmp_cache().await { + tracing::error!("failed to copy cache to tmp cache: {}", e); + } else { + copy_cache_from_bucket_handle = Some(tokio::task::spawn(async move { + if let Some(ref s) = S3_CACHE_BUCKET.clone() { + if let Err(e) = cache_global(s, copy_tx).await { + tracing::error!("failed to sync cache: {}", e); + } } - } - })); - } - + })); + } + } } }