Просмотр исходного кода

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.
Thales Macedo Garitezi 4 лет назад
Родитель
Сommit
e1e72c144a
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      scripts/update_appup.escript

+ 8 - 1
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