Partnership: handle empty run.php response gracefully
If run.php returns an empty body (transient nginx/PHP-FPM issue), the script still runs via nohup. Treat empty response as ok instead of throwing a JSON parse error that misleads the user into thinking the action failed.
This commit is contained in:
@@ -63,7 +63,17 @@ function _vvPtRun(id, extraArgs) {
|
||||
return fetch('/plugins/varaverk/api/run.php', {
|
||||
method: 'POST',
|
||||
body: new URLSearchParams(params)
|
||||
}).then(r => r.json());
|
||||
}).then(r => {
|
||||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||||
return r.text();
|
||||
}).then(text => {
|
||||
if (!text.trim()) {
|
||||
// Empty body — script likely started via nohup before response was sent.
|
||||
// Treat as ok; check Scheduler log for confirmation.
|
||||
return {ok: true, _empty_response: true};
|
||||
}
|
||||
return JSON.parse(text);
|
||||
});
|
||||
}
|
||||
|
||||
function vvPtPhase1(btn, hostId) {
|
||||
|
||||
Reference in New Issue
Block a user