Stop a DynamicSupervisor after a period of time

I’ve got a quick little issue. I have a system which uses DynamicSupervisors to launch various child processes.

I’d like to end these supervisors after a period of time. There is a convenient pattern for doing this with GenServers: elixir - What is the recomended way to terminate a process if it's unused? - Stack Overflow - but I’d like to be able to do this at the DynamicSupervisor level - invoke the DynamicSupervisor.stop function after a period of time.

Is this ability provided anywhere, or do I need another process to handle DynamicSupervisor termination?

Thanks

If you’re fine with alternative supervisor libraries you could look at parent, which allows you to do more in a supervisor like process than just being a supervisor.

Though I wonder what you want to timeout on? Messages seems strange, as the child could be very actively working while the supervisor is just idle.

Do you mean this?: GitHub - sasa1977/parent: Custom parenting of processes in Elixir

Even if the children are still running, I want them stopped. The time window where they were wanted has passed, and now they need to be terminated.