fix(backend): fix initial worker ping issue

This commit is contained in:
Ruben Fiszel
2023-05-29 13:53:46 +02:00
parent d3e787f9d4
commit 7e6ccacbf7
2 changed files with 2 additions and 6 deletions
+1 -5
View File
@@ -332,11 +332,7 @@ pub async fn run_workers<R: rsmq_async::RsmqConnection + Send + Sync + Clone + '
for i in 1..(num_workers + 1) {
let db1 = db.clone();
let instance_name = instance_name.clone();
let worker_name = if num_workers > 1 {
format!("wk-{}-{}", &instance_name, i)
} else {
format!("wk-{}", &instance_name)
};
let worker_name = format!("wk-{}-{}", &instance_name, rd_string(5));
let ip = ip.clone();
let rx = rx.resubscribe();
let base_internal_url = base_internal_url.clone();
+1 -1
View File
@@ -856,7 +856,7 @@ async fn insert_initial_ping(
db: &Pool<Postgres>,
) {
sqlx::query!(
"INSERT INTO worker_ping (worker_instance, worker, ip) VALUES ($1, $2, $3)",
"INSERT INTO worker_ping (worker_instance, worker, ip) VALUES ($1, $2, $3) ON CONFLICT (worker) DO NOTHING",
worker_instance,
worker_name,
ip