GlobalChild
TODO: Add description
Installation
def deps do
[
{:global_child, "~> 0.1.1"},
]
endDocumentation
The documentation is available on hexdocs.pm
Usage
To start a globally unique child, wrap its child spec with a GlobalChild
child spec tuple:
children = [
# ...
{GlobalChild, child: {MyApp.Worker, name: {:global, :worker}}},
# ...
]Options
:child– Required. The child specification of the global process.:debug– Optional, defaults tofalse. Enables logger debug message whentrue.:sleep– Optional, defaults to0. A duration in milliseconds to sleep for before attempting to start the global child. This is useful to let the cluster form and allow:globalto synchronize with other nodes. Without a delay, the process may start on several nodes, though eventually there will only be one left after:globalis synchronized. See:global.sync/0if you need to enforce the synchronization.
Configuration
The default values for :debug and :sleep options can be set at the
configuration level. Those values are pulled at runtime.
config :global_child,
debug: true,
sleep: 1500