Skip to content

Commit

Permalink
fix: storage or registry can be nil
Browse files Browse the repository at this point in the history
  • Loading branch information
fahchen committed Jun 17, 2023
1 parent 0887b5c commit fb6f9f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions lib/workflow_metal/application/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ defmodule WorkflowMetal.Application.Supervisor do

config_child_spec = config_child_spec(application, config)

children = [
config_child_spec,
registry_child_spec,
storage_child_spec,
{WorkflowMetal.Application.WorkflowsSupervisor, application}
]
children =
Enum.reject(
[
config_child_spec,
registry_child_spec,
storage_child_spec,
{WorkflowMetal.Application.WorkflowsSupervisor, application}
],
&is_nil/1
)

Supervisor.init(children, strategy: :one_for_one)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/workflow_metal/registration/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule WorkflowMetal.Registration.Adapter do
Return a supervisor spec for the registry
"""
@callback child_spec(application, config) ::
{:ok, :supervisor.child_spec() | {module, term} | module, adapter_meta}
{:ok, :supervisor.child_spec() | {module, term} | module | nil, adapter_meta}

@doc """
Return a `:via` tuple to route a message to a process by its registered name
Expand Down
2 changes: 1 addition & 1 deletion lib/workflow_metal/storage/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule WorkflowMetal.Storage.Adapter do
Return a child spec for the storage
"""
@callback child_spec(application, config) ::
{:ok, :supervisor.child_spec() | {module, term} | module, adapter_meta}
{:ok, :supervisor.child_spec() | {module, term} | module | nil, adapter_meta}

# Workflow

Expand Down

0 comments on commit fb6f9f6

Please sign in to comment.