Skip to content

Commit 1affe2b

Browse files
committed
fix(cluster): gg dns records leak if server destroyed before install complete
1 parent a49bebd commit 1affe2b

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

svc/pkg/cluster/worker/src/workers/server_destroy.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ async fn inner(
7070
server.pool_type as i32
7171
));
7272
if let backend::cluster::PoolType::Gg = pool_type {
73-
// Update db record
74-
sql_execute!(
75-
[ctx]
76-
"
77-
UPDATE db_cluster.servers_cloudflare
78-
SET destroy_ts = $2
79-
WHERE
80-
server_id = $1 AND
81-
destroy_ts IS NULL
82-
",
83-
server_id,
84-
util::timestamp::now(),
85-
)
86-
.await?;
87-
8873
msg!([ctx] cluster::msg::server_dns_delete(server_id) {
8974
server_id: ctx.server_id,
9075
})

svc/pkg/cluster/worker/src/workers/server_dns_delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ async fn inner(
6363
secondary_dns_record_id,
6464
}) = row
6565
else {
66+
// TODO: This might get stuck in a loop if does not finish installing
6667
// NOTE: It is safe to do nothing in this case because both this worker and
6768
// `cluster-server-dns-create` use transactions
68-
tracing::warn!("server has no dns records");
69-
return Ok(());
69+
retry_bail!("server has no dns records yet");
7070
};
7171

7272
let zone_id = unwrap!(util::env::cloudflare::zone::job::id(), "dns not configured");

0 commit comments

Comments
 (0)