luci: updater: Fix timer using

This commit is contained in:
remittor
2025-12-24 14:39:52 +03:00
parent 8aff441b88
commit 3d3eb82b7b

View File

@@ -132,7 +132,11 @@ return baseclass.extend({
}
let lastLen = 0;
let retCode = -1;
let timerBusy = false;
let timer = setInterval(async () => {
if (timerBusy)
return; // skip iteration
timerBusy = true;
try {
let res = await fs.exec('/bin/cat', [ logFile ], null, rpc_opt);
if (res.stdout && res.stdout.length > lastLen) {
@@ -169,7 +173,10 @@ return baseclass.extend({
} catch (e) {
clearInterval(timer);
this.appendLog('ERROR: installUpdates: ' + e.message);
this.appendLog('ERROR: installUpdates: ' + e.stack?.trim().split('\n').pop());
this.setStage(999);
} finally {
timerBusy = false;
}
}, 500);
},