Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created October 31, 2020 23:31
Show Gist options
  • Save krainboltgreene/b4523933ed4c5346d4776cefc42796d6 to your computer and use it in GitHub Desktop.
Save krainboltgreene/b4523933ed4c5346d4776cefc42796d6 to your computer and use it in GitHub Desktop.
defmodule ElixirContainerAgentExperiment.Application do
use Application
def start(_type, _args) do
children = [
{
Task.Supervisor,
name: ElixirContainerAgentExperiment.ExampleSupervisor
}
]
opts = [strategy: :one_for_one, name: ElixirContainerAgentExperiment.Supervisor]
Supervisor.start_link(children, opts)
end
end
defmodule ElixirContainerAgentExperiment do
require Logger
def hello do
Logger.info("Starting outer")
Task.Supervisor.async(ElixirContainerAgentExperiment.ExampleSupervisor, fn () ->
Logger.info("Starting inner")
:ok = Process.sleep(30000 * 3)
Logger.info("Finishing inner")
end)
Logger.info("Continuing outer")
:ok = Process.sleep(30000)
Logger.info("Finishing outer")
end
end
defmodule ElixirContainerAgentExperiment.ExampleSupervisor do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment