# `Condukt.Park`
[🔗](https://github.com/tuist/tuist/blob/condukt@3.0.0/condukt/lib/condukt/park.ex#L1)

How a tool call waits for an outside event or a time.

A tool parks by returning `{:park, state, opts}` from `c:Condukt.Tool.call/2`
instead of a result, much as a `GenServer` callback returns
`{:noreply, state, timeout}`:

    {:park, %{build_id: build.id},
     signals: [{MyApp.Signals.CiResult, "ci-" <> context.tool_call_id}],
     timeout: :timer.hours(2)}

Options:

  * `:signals` - `{kind, key}` pairs to wake on, where `kind` is a
    `Condukt.Signal` module and `key` a string. The first one delivered
    wakes the call.
  * `:timeout` - milliseconds from now after which the call wakes anyway.
  * `:until` - a `DateTime` after which the call wakes anyway. Use either
    `:until` or `:timeout`, not both.

A park needs signals, a deadline, or both, and the tool must implement
`c:Condukt.Tool.wake/3`. While a call is parked no tool code runs: the
turn's worker blocks in `receive`, the tool timeout does not apply, and the
session holds the wait as data. When the call wakes, the session calls
`wake/3` with `{:signal, {kind, key}, value}` or `:timeout`, and `state`.

The deadline is stored as wall-clock time rather than as a timer, so it
means the same thing after the session process that armed it is gone. A
running session arms it with `Process.send_after/3`.

See the [Waiting for Events](parking.md) guide.

# `new`

Validates park options, returning `{:ok, park}` or `{:error, reason}`.

`until` in the result is a Unix time in milliseconds, or `nil`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
