Skip to content

Commit

Permalink
fix(job-run): correctly clean up leaked proxied ports
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry authored and MasterPtato committed May 31, 2024
1 parent 6254a0c commit c93cc9a
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit c93cc9a

Please sign in to comment.