@@ -72,13 +72,10 @@ update_app_config(ConfigFile) ->
7272 % % For application config to be updated, applications should
7373 % % be unloaded first.
7474 % % If an application is already running, print an error.
75- lists :foreach (fun ({App , _Config }) ->
75+ lists :foreach (fun ({App , AppConfig }) ->
7676 case lists :member (App , RunningApps ) of
7777 true ->
78- io :format (standard_error ,
79- " ~n Unable to update config for app ~p from *.conf file."
80- " App is already running. Use advanced.config instead.~n " ,
81- [App ]);
78+ maybe_print_warning_for_running_app (App , AppConfig );
8279 false ->
8380 case lists :member (App , LoadedApps ) of
8481 true -> application :unload (App );
@@ -87,11 +84,48 @@ update_app_config(ConfigFile) ->
8784 end
8885 end ,
8986 Config ),
87+ maybe_set_net_ticktime (proplists :get_value (kernel , Config )),
9088 ok = application_controller :change_application_data ([], [ConfigFile ]),
9189 % % Make sure to load all the applications we're unloaded
9290 lists :foreach (fun (App ) -> application :load (App ) end , LoadedApps ),
9391 ok .
9492
93+ maybe_print_warning_for_running_app (kernel , Config ) ->
94+ ConfigWithoutSupportedEntry = proplists :delete (net_ticktime , Config ),
95+ case length (ConfigWithoutSupportedEntry ) > 0 of
96+ true -> io :format (standard_error ,
97+ " ~n Unable to update config for app ~p from a .conf file."
98+ " The app is already running. Use advanced.config instead.~n " , [kernel ]);
99+ false -> ok
100+ end ;
101+ maybe_print_warning_for_running_app (App , _Config ) ->
102+ io :format (standard_error ,
103+ " ~n Unable to update config for app ~p from a .conf file: "
104+ " The app is already running.~n " ,
105+ [App ]).
106+
107+ maybe_set_net_ticktime (undefined ) ->
108+ ok ;
109+ maybe_set_net_ticktime (KernelConfig ) ->
110+ case proplists :get_value (net_ticktime , KernelConfig ) of
111+ undefined ->
112+ ok ;
113+ NetTickTime ->
114+ case net_kernel :set_net_ticktime (NetTickTime , 0 ) of
115+ unchanged ->
116+ ok ;
117+ change_initiated ->
118+ ok ;
119+ {ongoing_change_to , NewNetTicktime } ->
120+ io :format (standard_error ,
121+ " ~n Couldn't set net_ticktime to ~p "
122+ " as net_kernel is busy changing net_ticktime to ~p seconds ~n " ,
123+ [NetTickTime , NewNetTicktime ]);
124+ _ ->
125+ ok
126+ end
127+ end .
128+
95129generate_config_file (ConfFiles , ConfDir , ScriptDir ) ->
96130 generate_config_file (ConfFiles , ConfDir , ScriptDir ,
97131 schema_dir (), get_advanced_config ()).
0 commit comments