Skip to content
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

Send shutdown messages to users when signaltower shuts down #24

Merged
merged 1 commit into from
Jun 6, 2020

Conversation

farao
Copy link
Member

@farao farao commented May 28, 2020

Closes #20

_ ->
:ok
end)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the signal handler?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Is this the signal handler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by signal handler? stop(state) is a callback of the Application behaviour ("interface") and it gets called when the application is asked to shut down - is that what you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what i mean. I was refering to signal handlers used in c++ programms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the 'asked to shutdown' compareable to unix signal e.g.: sigterm?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. "By default, a SIGTERM from the operating system will automatically translate to System.stop/0." https://hexdocs.pm/elixir/Application.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx a lot for clarification!

@@ -45,4 +40,16 @@ defmodule SignalTower do
Logger.info("SignalTower started")
ret
end

@impl Application
def stop(_) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the _state in the previous version, because it gives me an idea about the variable content/type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will bring it back ;-)

@farao farao merged commit 1a839fd into master Jun 6, 2020
@farao farao deleted the shutdown branch June 6, 2020 08:54
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.

Send shutdown event when shutting down
2 participants