mirror of
https://github.com/smittix/intercept.git
synced 2026-06-17 09:59:47 -07:00
Fix WeFax start/stop/SSE reliability
- Replace blocking stdout.read() with select()-based non-blocking reads so the decode thread responds to stop within 0.5s - Make stop() non-blocking by releasing the lock before terminating the process and removing the redundant wait() - Move initial scanning SSE event from start() into the decode thread so it fires after the frontend EventSource connects - Update frontend stop() to give immediate UI feedback before the fetch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -205,16 +205,20 @@ var WeFax = (function () {
|
||||
}
|
||||
|
||||
function stop() {
|
||||
// Immediate UI feedback before waiting for backend response
|
||||
state.running = false;
|
||||
updateButtons(false);
|
||||
setStatus('Stopping...');
|
||||
disconnectSSE();
|
||||
|
||||
fetch('/wefax/stop', { method: 'POST' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function () {
|
||||
state.running = false;
|
||||
updateButtons(false);
|
||||
setStatus('Stopped');
|
||||
disconnectSSE();
|
||||
loadImages();
|
||||
})
|
||||
.catch(function (err) {
|
||||
setStatus('Stopped');
|
||||
console.error('WeFax stop error:', err);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user