mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 16:02:24 +00:00
fix: handle more gracefully worker without tags
This commit is contained in:
@@ -86,6 +86,10 @@ lazy_static::lazy_static! {
|
||||
}
|
||||
|
||||
pub async fn make_suspended_pull_query(wc: &WorkerConfig) {
|
||||
if wc.worker_tags.len() == 0 {
|
||||
tracing::error!("Empty tags in worker tags, skipping");
|
||||
return;
|
||||
}
|
||||
let query = format!(
|
||||
"UPDATE queue
|
||||
SET running = true
|
||||
@@ -114,6 +118,10 @@ pub async fn make_suspended_pull_query(wc: &WorkerConfig) {
|
||||
pub async fn make_pull_query(wc: &WorkerConfig) {
|
||||
let mut queries = vec![];
|
||||
for tags in wc.priority_tags_sorted.iter() {
|
||||
if tags.tags.len() == 0 {
|
||||
tracing::error!("Empty tags in priority tags, skipping");
|
||||
continue;
|
||||
}
|
||||
let query = format!("UPDATE queue
|
||||
SET running = true
|
||||
, started_at = coalesce(started_at, now())
|
||||
|
||||
@@ -1967,6 +1967,11 @@ async fn pull_single_job_and_mark_as_running_no_concurrency_limit<
|
||||
* or suspend_until <= now() if it has timed out */
|
||||
let query = WORKER_SUSPENDED_PULL_QUERY.read().await;
|
||||
|
||||
if query.is_empty() {
|
||||
tracing::warn!("No suspended pull queries available");
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let r = if suspend_first {
|
||||
// tracing::info!("Pulling job with query: {}", query);
|
||||
sqlx::query_as::<_, QueuedJob>(&query)
|
||||
@@ -1982,6 +1987,11 @@ async fn pull_single_job_and_mark_as_running_no_concurrency_limit<
|
||||
|
||||
let queries = WORKER_PULL_QUERIES.read().await;
|
||||
|
||||
if queries.is_empty() {
|
||||
tracing::warn!("No pull queries available");
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
for query in queries.iter() {
|
||||
// tracing::info!("Pulling job with query: {}", query);
|
||||
let r = sqlx::query_as::<_, QueuedJob>(query)
|
||||
|
||||
Reference in New Issue
Block a user