Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(job-run): correctly clean up leaked proxied ports #832

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions svc/pkg/job-run/worker/src/workers/stop.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use chirp_worker::prelude::*;
use proto::backend::pkg::*;
use redis::AsyncCommands;
use tokio::task;

#[derive(Debug, sqlx::FromRow)]
Expand Down Expand Up @@ -52,6 +53,16 @@ async fn worker(ctx: &OperationContext<job_run::msg::stop::Message>) -> GlobalRe
}
};

// HACK: Remove from proxied ports early. This also gets removed in job-run-cleanup, but that
// may not run correclty if the dispatched job id is not set correctly.
ctx.redis_job()
.await?
.hdel(
util_job::key::proxied_ports(run_row.region_id),
run_id.to_string(),
)
.await?;

// Get the region
let region_res = op!([ctx] region_get {
region_ids: vec![run_row.region_id.into()],
Expand Down
Loading