chore: Remove slow pull warning in worker agent mode (#2866)

This commit is contained in:
Guillaume Bouvignies
2023-12-15 19:16:41 +01:00
committed by GitHub
parent 608af741ea
commit d84c359384
4 changed files with 9 additions and 5 deletions
+4 -1
View File
@@ -330,6 +330,7 @@ Windmill Community Edition {GIT_VERSION}
num_workers,
base_internal_url.clone(),
rsmq.clone(),
mode.clone() == Mode::Agent,
)
.await?;
tracing::info!("All workers exited.");
@@ -499,7 +500,7 @@ Windmill Community Edition {GIT_VERSION}
let instance_name = rd_string(8);
schedule_stats(
instance_name,
mode,
mode.clone(),
&db,
&HTTP_CLIENT,
cfg!(feature = "enterprise"),
@@ -571,6 +572,7 @@ pub async fn run_workers<R: rsmq_async::RsmqConnection + Send + Sync + Clone + '
num_workers: i32,
base_internal_url: String,
rsmq: Option<R>,
agent_mode: bool,
) -> anyhow::Result<()> {
let instance_name = gethostname()
.to_str()
@@ -652,6 +654,7 @@ pub async fn run_workers<R: rsmq_async::RsmqConnection + Send + Sync + Clone + '
&base_internal_url,
rsmq2,
sync_barrier,
agent_mode,
)
.await
})));
+1
View File
@@ -994,6 +994,7 @@ fn spawn_test_worker(
&base_internal_url,
None,
Arc::new(RwLock::new(None)),
false,
)
.await
};
+1 -1
View File
@@ -283,7 +283,7 @@ pub struct WrappedError {
pub error: serde_json::Value,
}
trait ValidableJson {
pub trait ValidableJson {
fn is_valid_json(&self) -> bool;
}
+3 -3
View File
@@ -545,6 +545,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
base_internal_url: &str,
rsmq: Option<R>,
_sync_barrier: Arc<RwLock<Option<Barrier>>>,
agent_mode: bool,
) {
#[cfg(not(feature = "enterprise"))]
if !*DISABLE_NSJAIL {
@@ -1364,7 +1365,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
let duration_pull_s = timer.elapsed().as_secs_f64();
let err_pull = job.is_ok();
let empty = job.as_ref().is_ok_and(|x| x.is_none());
if duration_pull_s > 0.5 {
if !agent_mode && duration_pull_s > 0.5 {
tracing::warn!("pull took more than 0.5s ({duration_pull_s}), this is a sign that the database is VERY undersized for this load. empty: {empty}, err: {err_pull}");
if empty {
if let Some(wp) = worker_pull_over_500_counter_empty.as_ref() {
@@ -1374,7 +1375,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
wp.inc();
}
} else if duration_pull_s > 0.1 {
} else if !agent_mode && duration_pull_s > 0.1 {
tracing::warn!("pull took more than 0.1s ({duration_pull_s}) this is a sign that the database is undersized for this load. empty: {empty}, err: {err_pull}");
if empty {
if let Some(wp) = worker_pull_over_100_counter_empty.as_ref() {
@@ -1383,7 +1384,6 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
} else if let Some(wp) = worker_pull_over_100_counter.as_ref() {
wp.inc();
}
}
if let Ok(j) = job.as_ref() {
if j.is_some() {