fix: wakeword back-off ceiling, save size limit, LaunchAgent restart-on-crash-only
parent
82ca58738c
commit
1568cc9eeb
|
|
@ -67,6 +67,9 @@ async function executeMacCommand(command) {
|
|||
if (resolved.filename.includes('/') || resolved.filename.includes('\\')) {
|
||||
return { success: false, output: 'Ungültiger Dateiname' };
|
||||
}
|
||||
if (typeof resolved.content === 'string' && resolved.content.length > 10 * 1024 * 1024) {
|
||||
return { success: false, output: 'Inhalt zu groß (max. 10 MB)' };
|
||||
}
|
||||
const filePath = `${process.env.HOME}/Desktop/${resolved.filename}`;
|
||||
fs.writeFileSync(filePath, resolved.content, 'utf8');
|
||||
return { success: true, output: `Gespeichert: ${filePath}` };
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ const path = require('path');
|
|||
let wakewordProcess = null;
|
||||
let running = false;
|
||||
|
||||
function startWakeword({ onWake }) {
|
||||
function startWakeword({ onWake }, retries = 0) {
|
||||
if (running) return;
|
||||
if (retries >= 10) {
|
||||
console.error('[Wakeword] Maximale Neustartversuche erreicht. Wakeword deaktiviert.');
|
||||
return;
|
||||
}
|
||||
running = true;
|
||||
|
||||
const scriptPath = path.join(__dirname, '../python/wakeword.py');
|
||||
|
|
@ -34,7 +38,9 @@ function startWakeword({ onWake }) {
|
|||
running = false;
|
||||
wakewordProcess = null;
|
||||
if (code !== 0 && signal === null) {
|
||||
setTimeout(() => startWakeword({ onWake }), 2000);
|
||||
const delay = Math.min(2000 * Math.pow(2, retries), 30000);
|
||||
console.error(`[Wakeword] Neustart in ${delay / 1000}s (Versuch ${retries + 1}/10)`);
|
||||
setTimeout(() => startWakeword({ onWake }, retries + 1), delay);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,10 @@
|
|||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>Crashed</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/fox-desktop.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
|
|
|
|||
Loading…
Reference in New Issue