From e1e72c144a696dde51b475b3e7978ddb324ccbc7 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Fri, 17 Dec 2021 15:50:47 -0300 Subject: [PATCH] chore(update_appup): do not use load_module if restart_application Since the appup instruction `restart_application` already loads all modules of a given application, there is no need to introduce those instructions if a restart is already present. --- scripts/update_appup.escript | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/update_appup.escript b/scripts/update_appup.escript index df2f2b164..65be8239b 100755 --- a/scripts/update_appup.escript +++ b/scripts/update_appup.escript @@ -295,11 +295,18 @@ do_merge_update_actions(App, Vsn, {New0, Changed0, Deleted0}, OldActions) -> New = New0 -- AlreadyHandled, Changed = Changed0 -- AlreadyHandled, Deleted = Deleted0 -- AlreadyHandled, - [{load_module, M, brutal_purge, soft_purge, []} || M <- Changed ++ New] ++ + Reloads = [{load_module, M, brutal_purge, soft_purge, []} + || not contains_restart_application(App, OldActions), + M <- Changed ++ New], + Reloads ++ OldActions ++ [{delete_module, M} || M <- Deleted] ++ AppSpecific. +%% If an entry restarts an application, there's no need to use +%% `load_module' instructions. +contains_restart_application(Application, Actions) -> + lists:member({restart_application, Application}, Actions). %% @doc Process the existing actions to exclude modules that are %% already handled