Skip to content

This application includes supervisors and workers using different strategies for initialize and restart.

Notifications You must be signed in to change notification settings

georgiybykov/supervision_tree

Repository files navigation

SupervisionTree

CI

This application includes supervisors and workers using different strategies for initialize and restart.


$ git clone git@github.com:georgiybykov/supervision_tree.git

$ cd supervision_tree

# Install and compile dependencies:
$ mix do deps.get, deps.compile

# Start IEx:
$ iex -S mix

For example, the Supervision Tree:

Supervision Tree

You can check it out by:

$ iex -S mix

iex(1)> :observer.start

And then go to the "Applications" tab (i.g. the screenshot is above).


You can check and play with different strategies of Supervisor in IEx like:

$ iex -S mix

Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Compiling 1 file (.ex)

21:47:07.498 [info]  main_worker_with_permanent_restart: is starting
21:47:07.501 [info]  main_worker_with_transient_restart: is starting
21:47:07.501 [info]  first_worker: is starting
21:47:07.501 [info]  second_worker: is starting
21:47:07.501 [info]  third_worker: is starting
21:47:07.501 [info]  fourth_worker: is starting
21:47:07.501 [info]  fifth_worker: is starting
21:47:07.501 [info]  sixth_worker: is starting
21:47:07.501 [info]  seventh_worker: is starting
21:47:07.501 [info]  eighth_worker: is starting
21:47:07.501 [info]  ninth_worker: is starting
21:47:07.501 [info]  sub_worker: is starting

# Let's try to terminate one of the workers right here:
iex(1)> SupervisionTree.Worker.stop(:seventh_worker)

# We can trace the behavior of workers below:
21:48:02.514 [info]  seventh_worker: is terminating
21:48:02.514 [info]  sub_worker: is terminating
21:48:02.514 [info]  ninth_worker: is terminating
21:48:02.514 [info]  eighth_worker: is terminating
21:48:02.514 [info]  seventh_worker: is starting
21:48:02.515 [info]  eighth_worker: is starting
21:48:02.515 [info]  ninth_worker: is starting
21:48:02.515 [info]  sub_worker: is starting

:ok

iex(2)> # Good luck! May the force be with you!

About

This application includes supervisors and workers using different strategies for initialize and restart.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages