CredoHotUpgrades.Check.LocalAcceptLoop (CredoHotUpgrades v1.0.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

The same problem as a local receive loop, for a process that waits in :gen_tcp.accept/1,2, :ssl.transport_accept/1,2 or :socket.accept/1,2 instead of receive:

defp accept_loop(listen) do
  {:ok, socket} = :gen_tcp.accept(listen)
  serve(socket)
  accept_loop(listen)   # never leaves the old code
end

This process is not a gen_server, so it cannot be suspended, and a bare recursive call stays on the code version it started on, blocking the next deploy's purge. Call __MODULE__.accept_loop(listen), or let ThousandIsland or Ranch own the loop instead.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.