From 33c74ae7f959ccd37468a8169b10c717d5226b41 Mon Sep 17 00:00:00 2001 From: Evan Prothro <798287+eprothro@users.noreply.github.com> Date: Thu, 2 May 2024 10:35:24 -0500 Subject: [PATCH] Add documentation for heroku node name (#1078) --- lib/oban.ex | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/oban.ex b/lib/oban.ex index aa7450b8..168ea1fd 100644 --- a/lib/oban.ex +++ b/lib/oban.ex @@ -400,11 +400,20 @@ defmodule Oban do ## Node Name - When the `node` value hasn't been configured it is generated based on the environment: + When the `node` value has not been configured it is generated based on the environment: + + 1. If the local node is alive (e.g. in a distributed system, or when running from a mix release) + the node name is used + 2. In a Heroku environment the system environment's `DYNO` value is used + 3. Otherwise, the system hostname is used + + When running a mix release on a Heroku node, the node is alive even if not part of a + distributed system. In order to use the `DYNO` value, configure the node value using runtime + configuration via `config/runtime.exs: + + config :my_app, Oban, + node: System.get_env("DYNO", "nonode@nohost") - * In a distributed system the node name is used - * In a Heroku environment the system environment's `DYNO` value is used - * Otherwise, the system hostname is used """ @doc since: "0.1.0" @spec start_link([option()]) :: Supervisor.on_start()