mirror of
https://github.com/troglobit/finit.git
synced 2026-10-18 10:59:34 +00:00
Only reload .conf and services if any .conf file has changed
This patch is an optimization. Now that we monitor for any .conf file changes (as soon as the event loop starts) we can skip automatic reload of all .conf files and services if no .conf file has changed. Unless the user issues an `initctl reload`, `init q`, or sends us SIGHUP. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
33ce746e58
commit
f2d142ef57
4 files changed
+14
-3
No files matched your search
@@ -633,6 +633,14 @@ static int do_change(char *name, uint32_t mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int conf_any_change(void)
|
||||
{
|
||||
if (TAILQ_EMPTY(&conf_change_list))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int conf_changed(char *file)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -33,6 +33,7 @@ char *rlim2str(int rlim);
|
||||
|
||||
int conf_init (void);
|
||||
void conf_reload (void);
|
||||
int conf_any_change (void);
|
||||
int conf_changed (char *file);
|
||||
int conf_monitor (uev_ctx_t *ctx);
|
||||
|
||||
|
||||
+4
-2
@@ -291,13 +291,15 @@ static void finalize(void)
|
||||
if (runparts && fisdir(runparts)) {
|
||||
_d("Running startup scripts in %s ...", runparts);
|
||||
run_parts(runparts, NULL);
|
||||
service_reload_dynamic();
|
||||
if (conf_any_change())
|
||||
service_reload_dynamic();
|
||||
}
|
||||
|
||||
/* Convenient SysV compat for when you just don't care ... */
|
||||
if (!access(FINIT_RC_LOCAL, X_OK)) {
|
||||
run_interactive(FINIT_RC_LOCAL, "Calling %s", FINIT_RC_LOCAL);
|
||||
service_reload_dynamic();
|
||||
if (conf_any_change())
|
||||
service_reload_dynamic();
|
||||
}
|
||||
|
||||
/* Hooks that should run at the very end */
|
||||
|
||||
Reference in new issue
Block a user