fix apache restart monitor

This commit is contained in:
Dmitry Belyaev 2021-06-17 12:50:43 +03:00
parent daadee9190
commit fd87391383
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -10,18 +10,17 @@ export default {
state: { state: {
apache_need_restart: false, apache_need_restart: false,
restart_flag: false, restart_flag: false,
flag_sent: false,
}, },
mutations: { mutations: {
setApacheNeedRestart(state) { setApacheNeedRestart(state) {
state.apache_need_restart = true; state.apache_need_restart = true;
}, },
setApacheRestartFlag(state, flag) { setApacheRestartFlag(state, flag) {
if (state.restart_flag && !flag) {
state.apache_need_restart = false;
}
state.restart_flag = flag; state.restart_flag = flag;
}, },
setApacheRestartFlagSent(state, flag) {
state.flag_sent = flag;
},
}, },
actions: { actions: {
async fetchApacheRestartFlag(ctx) { async fetchApacheRestartFlag(ctx) {
@ -30,10 +29,6 @@ export default {
ctx.commit("setApacheRestartFlag", true); ctx.commit("setApacheRestartFlag", true);
} catch (err) { } catch (err) {
ctx.commit("setApacheRestartFlag", false); ctx.commit("setApacheRestartFlag", false);
if (ctx.getters.isApacheRestartFlagSent) {
ctx.commit("setApacheNeedRestart", false);
ctx.commit("setApacheRestartFlagSent", false);
}
} }
}, },
async updateApacheRestartFlag(ctx) { async updateApacheRestartFlag(ctx) {
@ -46,7 +41,6 @@ export default {
try { try {
await axios.put(`${api_base}/apache-restart`); await axios.put(`${api_base}/apache-restart`);
ctx.commit("setApacheRestartFlag", true); ctx.commit("setApacheRestartFlag", true);
ctx.commit("setApacheRestartFlagSent", true);
} catch (err) { } catch (err) {
pass(); pass();
} }
@ -59,8 +53,5 @@ export default {
isApacheRestartPending(state) { isApacheRestartPending(state) {
return state.restart_flag; return state.restart_flag;
}, },
isApacheRestartFlagSent(state) {
return state.flag_sent;
},
}, },
}; };