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.
This commit is contained in:
Thales Macedo Garitezi 2021-12-17 15:50:47 -03:00
parent 3ff6661a58
commit e1e72c144a
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
1 changed files with 8 additions and 1 deletions

View File

@ -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