Skip to main content

allocate

Function allocate 

Source
pub fn allocate(
    workers: &[String],
    base_port: Option<u16>,
    opts: &DevOptions,
) -> Vec<Serving>
Expand description

Allocate a port per worker (#552): wrangler dev binds one port per process, so serving N contexts means N distinct ports, assigned base + i over the deterministic worker order.

The one exception preserves the pre-#552 contract: a lone worker with no explicit --base-port gets None — no injected --port at all — so it lands on wrangler’s own default and -- --port N still works. Injecting unconditionally would break that, because a repeated --port is a hard wrangler error, not last-wins.