mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-11 00:06:06 +00:00
improve vacuum queue
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "VACUUM queue",
|
||||
"query": "VACUUM (skip_locked) queue",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
@@ -8,5 +8,5 @@
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "1e232d4b978d133ba542d0abe5afaa0031f630c5336c0b805590b5ea4508ed04"
|
||||
"hash": "c24d63fb137b805f1e674261681d15e6405de27d40b799b0a65b31fd41bcc625"
|
||||
}
|
||||
@@ -1381,15 +1381,16 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
|
||||
|
||||
if (jobs_executed as u32 + vacuum_shift) % VACUUM_PERIOD == 0 {
|
||||
let db2 = db.clone();
|
||||
let worker_instance = worker_instance.to_string();
|
||||
let ip = ip.to_string();
|
||||
let worker_name2 = worker_name.clone();
|
||||
tokio::task::spawn(async move {
|
||||
tracing::info!(worker = %worker_name2, "vacuuming queue and completed_job");
|
||||
if let Err(e) = sqlx::query!("VACUUM (skip_locked) queue").execute(&db2).await {
|
||||
if let Err(e) = sqlx::query!("VACUUM (skip_locked) queue")
|
||||
.execute(&db2)
|
||||
.await
|
||||
{
|
||||
tracing::error!(worker = %worker_name2, "failed to vacuum queue: {}", e);
|
||||
}
|
||||
tracing::info!(worker = %worker_name, "vacuumed queue and completed_job");
|
||||
tracing::info!(worker = %worker_name2, "vacuumed queue and completed_job");
|
||||
});
|
||||
jobs_executed += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user