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

Make application:stop/1 callback optional #7990

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

josevalim
Copy link
Contributor

The majority of the times it simply returns ok.
In Erlang/OTP itself, only ssl and snmp implemented it.

Note we didn't have to change the implementation
because the callback is always invoked as
catch App:stop(Arg), which is also how other optional
callbacks, such as prep_stop/1 are handled.

The majority of the times it simply returns ok.
In Erlang/OTP itself, only ssl and snmp implemented it.

Note we didn't have to change the implementation
because the callback is always invoked as
`catch App:stop(Arg)`, which is also how other optional
callbacks, such as `prep_stop/1` are handled.
Copy link
Contributor

github-actions bot commented Jan 1, 2024

CT Test Results

   13 files    313 suites   3h 11m 37s ⏱️
5 573 tests 5 085 ✅ 486 💤 2 ❌
8 084 runs  7 445 ✅ 637 💤 2 ❌

For more details on these failures, see this check.

Results for commit b1e516b.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@josevalim
Copy link
Contributor Author

CI is failing but it may be a cache issue (other applications being recompiled before kernel?). Or let me know if you would prefer me to break this in two PRs (one that changes application.erl, another that removes its usage).

@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jan 8, 2024
@garazdawi
Copy link
Contributor

@josevalim CI fails because the primary bootstrap needs to be updated. I pushed a commit that does that.

I'll leave deciding if we want this or not to next week.

@essen
Copy link
Contributor

essen commented Feb 26, 2024

A lot of the time the start function only calls my_sup:start_link as well. If there's nothing special to do for starting or stopping the application, then perhaps we can skip that module altogether?

That said, that module is typically filled by templates or copy pasting, so it being optional, or the stop callback being optional, doesn't really change much.

@max-au
Copy link
Contributor

max-au commented Mar 27, 2024

Speaking of which, there is also *.app file that specifies which module contains the actual application behaviour. Maybe it's better to support it this way:

{application, myapp,
 [{description, "Description of myapp"},
  {vsn, "1.0.0"},
  {supervisor, {myapp_sup, []}},

Meaning, instead of {mod, myapp}, it'd have {supervisor, myapp_sup}.

The more I think about it, the more I like it. Less code - less space for bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants