Skip to main content

compute_preferred_port

Function compute_preferred_port 

Source
pub fn compute_preferred_port(
    repo_id: &str,
    branch: &str,
    port_range_start: u16,
    port_range_end: u16,
) -> u16
Expand description

Compute the preferred port for a branch within a port range.

Formula: port_range_start + (sha256(format!(“{repo_id}:{branch}”))[0..4] as u32 % range_size)