New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MuonTrap.Daemon new features #31
Conversation
Looks good to me - excited to have this! |
@alde103 Could you trim this PR back so that it only contains the message callback function? |
Ok, Is something wrong with |
Combining multiple changes in one PR makes it difficult to review. I maintain muontrap in my free time, so while I appreciate the PR, a lot, it is unlikely that I'll have a block of free time long enough to work through a big code change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at the :telemetry
library and wondering if that's a better solution.
:telemetry
would remove the need for passing an option. Interested parties could register handlers and receive events. You may already be set up to capture these events.
Second, I know that you're interested in start and exit events as well. I could imagine other potentially interesting events. If we used :telemetry
, those could be added with out adding new callback options.
The downside is that it's another dependency. I usually try to avoid that, but :telemetry
is getting pulled in already by so many libraries that it's probably available anyway.
Curious on thoughts.
* `:stderr_to_stdout` - When set to `true`, redirect stderr to stdout. Defaults to `false`. | ||
|
||
If you want to run multiple `MuonTrap.Daemon`s under one supervisor, they'll | ||
all need unique IDs. Use `Supervisor.child_spec/2` like this: | ||
|
||
```elixir | ||
Supervisor.child_spec({MuonTrap.Daemon, ["my_server"), []]}, id: :server1) | ||
Supervisor.child_spec({MuonTrap.Daemon, ["my_server", []]}, id: :server1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you separate this typo fix out into a separate PR? This fix is an easy one for me to merge right away.
Interesting, to be honest, I have never used |
Regarding non-blocking callbacks, I'm pretty sure we have the same requirement here. I.e., if MuonTrap calls a function that blocks, the GenServer could be delayed from handling OS process exits and then that holds up a restart of the failed OS process. Regarding this patch, could you describe your use case? I'm re-reading our dialog and wondering if I'm misunderstanding what you're trying to accomplish and whether there's a really easily alternative. |
I think you are right, my first impressions of I think we should associate the event to the PID, but it seems that |
I'm a fan of implementing via |
After thinking about it the past two weeks, my opinion on adding additional callbacks (non-telemetry ones) to the daemon options is not something I want. Part of this is due to a desire to keep the As for So in summary, I'd like to push forward on getting experience with I hope this makes sense and thanks for hanging through this as we figure it out together. |
In response of #30
I added the following option in
MuonTrap.Daemon
: