View Source Flagsmith.Supervisor (flagsmith_engine v1.0.0)

Implements the necessary supervision tree to ensure Poller and Analytics processors can be started, accessed and supervised correctly.

To use it either add it to your application supervision tree:

defmodule YourApp.Application do

  # ...

  def start(_type, _args) do
    children = [
      Flagsmith.Supervisor,
      # ... other stuff
    ]

    opts = [strategy: :one_for_one, name: YourApp.Supervisor]
    Supervisor.start_link(children, opts)
  end

  # ...
end

Or start it somewhere:

{:ok, pid} = Flagsmith.Supervisor.start_link()

This supervisor starts 3 additional processes, a local Registry and two dynamic supervisors responsible for starting Pollers and Analytics processes (usually a single one, but since they are isolated by sdk key used, if you use multiple sdks to access different environments in Flagsmith, in the same application you'll end up with that same amount of processes, number of environments times 2). The pollers and analytics are only started once there are interactions with either, and they stay until application shutdown.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.