修改 api 限流策略,修复检查检查日志

This commit is contained in:
whyour
2023-06-07 22:45:37 +08:00
parent f64ff83414
commit 5b1accffb7
5 changed files with 1792 additions and 1879 deletions
+5 -2
View File
@@ -10,19 +10,22 @@ const check = async (
switch (call.request.service) {
case 'cron':
const res = await promiseExec(
`curl -sf http://localhost:${config.port}/api/system`,
`curl -s http://localhost:${config.port}/api/system`,
);
if (res.includes('200')) {
return callback(null, { status: 1 });
}
const panelErrLog = await promiseExec(
`tail -n 300 ~/.pm2/logs/panel-error.log`,
);
const scheduleErrLog = await promiseExec(
`tail -n 300 ~/.pm2/logs/schedule-error.log`,
);
return callback(new Error(`${scheduleErrLog}\n${panelErrLog}`));
return callback(
new Error(`${scheduleErrLog || ''}\n${panelErrLog || ''}\n${res}`),
);
default:
return callback(null, { status: 1 });