Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2424-Simplify-dependency-checks-for-application...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2424-Simplify-dependency-checks-for-applications.patch of Package erlang
From dd572ad72b67f5b199d078044d2fd4a7c9164ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= <micmus@fb.com> Date: Tue, 23 Jan 2024 15:15:26 +0000 Subject: [PATCH 4/6] Simplify dependency checks for applications --- lib/kernel/src/application_controller.erl | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl index 196ea63b2b..0e8328578b 100644 --- a/lib/kernel/src/application_controller.erl +++ b/lib/kernel/src/application_controller.erl @@ -1345,14 +1345,10 @@ check_start_cond(AppName, RestartType, Started, Running) -> true -> {error, {already_started, AppName}}; false -> - foreach( - fun(AppName2) -> - case lists:keymember(AppName2, 1, Started) orelse - lists:member(AppName2, Appl#appl.opt_apps) of - true -> ok; - false -> throw({error, {not_started, AppName2}}) - end - end, Appl#appl.apps), + case find_missing_dependency(Appl, Started) of + {value, NotStarted} -> throw({error, {not_started, NotStarted}}); + false -> ok + end, {ok, Appl} end; false -> @@ -1405,14 +1401,10 @@ reply(From, Reply) -> gen_server:reply(From, Reply). start_appl(Appl, Running, Type) -> ApplData = Appl#appl.appl_data, %% Name = ApplData#appl_data.name, - foreach( - fun(AppName) -> - case lists:keymember(AppName, 1, Running) orelse - lists:member(AppName, Appl#appl.opt_apps) of - true -> ok; - false -> throw({info, {not_running, AppName}}) - end - end, Appl#appl.apps), + case find_missing_dependency(Appl, Running) of + {value, NotRunning} -> throw({info, {not_running, NotRunning}}); + false -> ok + end, case application_master:start_link(ApplData, Type) of {ok, _Pid} = Ok -> Ok; @@ -1420,6 +1412,9 @@ start_appl(Appl, Running, Type) -> throw(Error) end. +find_missing_dependency(Appl, Applications) -> + Pred = fun(AppName) -> not lists:keymember(AppName, 1, Applications) end, + lists:search(Pred, Appl#appl.apps -- Appl#appl.opt_apps). %%----------------------------------------------------------------- %% Stop application locally. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor