OnchainJs.RuntimeSupervisor (onchain_js v0.2.0)

Copy Markdown View Source

DynamicSupervisor for OnchainJs.Runtime processes.

Started as part of the OnchainJs.Application supervision tree under the registered name OnchainJs.RuntimeSupervisor. No runtimes are started by default — consumers spawn supervised runtimes on demand:

{:ok, pid} =
  DynamicSupervisor.start_child(
    OnchainJs.RuntimeSupervisor,
    {OnchainJs.Runtime, []}
  )

:ok = DynamicSupervisor.terminate_child(OnchainJs.RuntimeSupervisor, pid)

Strategy is :one_for_one: a crashed runtime is not auto-restarted because child specs from OnchainJs.Runtime.child_spec/1 use restart: :transient, matching the lifetime of the loaded JS bundle.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start the supervisor under the registered name OnchainJs.RuntimeSupervisor.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(init_arg \\ [])

@spec start_link(keyword()) :: Supervisor.on_start()

Start the supervisor under the registered name OnchainJs.RuntimeSupervisor.