Skip to content

Conversation

lpil
Copy link
Member

@lpil lpil commented Sep 24, 2025

A module for supervision of processes of a fixed type which are dynamically started while the program is running! aka Erlang's "simple one for one" supervisor.

@lpil lpil force-pushed the factory-supervisor branch 2 times, most recently from dc758ca to 47705c4 Compare September 24, 2025 18:29
@lpil lpil force-pushed the factory-supervisor branch from 47705c4 to 02d7367 Compare September 24, 2025 19:02
@lpil lpil marked this pull request as ready for review October 1, 2025 17:58
@keroami
Copy link

keroami commented Oct 1, 2025

From the outside: was looking for factory_supervisor.new(), turned out is was called worker_child(). Oh, because of supervisor_child(). NIce, I hadn't thought of that.

For the rest, I was replacing some code that added 5 static children to a single supervisor, I had practically everything ready. It fell into place as I would want to. API is consistent with the rest of gleam/otp.

Inside: since it is a wrapper, there isn't all that much going on in the code. Looks fine.

@karlsson
Copy link
Contributor

karlsson commented Oct 1, 2025

I notice that the type Message has child_argument and child_data as "parameterized" types and in the end it looks as if it turns out to be (in my case) the request and response subjects for the children created by the named factory supervisor. Very neat, and it makes sense, but maybe there could be some descriptive documentation for the Message type?

import gleam/otp/factory_supervisor as fsup
..
..
  let sup_name: process.Name(
    fsup.Message(
      process.Subject(msg.ClientRequest(String)),
      process.Subject(msg.ClientResponse(String)),
    ),
  ) = process.new_name("factory_sup")

factory_supervisor

@lpil lpil changed the title Factory supervisor for supevision of dynamic processes Factory supervisor for supervision of dynamic processes Oct 2, 2025
@lpil
Copy link
Member Author

lpil commented Oct 2, 2025

Thank you everyone!

@lpil lpil merged commit 7574afb into main Oct 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants