Skip to content

Commit

Permalink
feat(worker): use hostname as ws arg
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Jun 19, 2024
1 parent 807728e commit 8b75f5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions worker/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,18 @@ async fn build_worker_inner(args: &Args) -> anyhow::Result<()> {
.timeout(Duration::from_secs(30))
.build()
.unwrap();

let hostname = gethostname::gethostname().to_string_lossy().to_string();
let req = WorkerPollRequest {
hostname: gethostname::gethostname().to_string_lossy().to_string(),
hostname: hostname.clone(),
arch: args.arch.clone(),
worker_secret: args.worker_secret.clone(),
memory_bytes: get_memory_bytes(),
disk_free_space_bytes: fs2::free_space(std::env::current_dir()?)? as i64,
logical_cores: num_cpus::get() as i32,
};

let ws = Url::parse(&args.websocket)?.join(&args.port.to_string())?;
let ws = Url::parse(&args.websocket)?.join(&hostname)?;

let (tx, rx) = unbounded();

Expand Down
4 changes: 0 additions & 4 deletions worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ pub struct Args {
/// Websocket uri
#[arg(short = 'w', long, env = "BUILDIT_WS")]
pub websocket: String,

/// Worker machine relay port
#[arg(long, env = "BUILDIT_RELAY_PORT")]
pub port: u16,
}

pub fn get_memory_bytes() -> i64 {
Expand Down

0 comments on commit 8b75f5b

Please sign in to comment.