fix: use res.on('close') to avoid premature kill
This commit is contained in:
@@ -71,7 +71,9 @@ app.post('/api/chat', (req, res) => {
|
|||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
req.on('close', () => { try { proc.kill(); } catch (e) {} });
|
let finished = false;
|
||||||
|
proc.on('close', () => { finished = true; });
|
||||||
|
res.on('close', () => { if (!finished) try { proc.kill(); } catch (e) {} });
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(8108, () => console.log('sechenov :8108'));
|
app.listen(8108, () => console.log('sechenov :8108'));
|
||||||
|
|||||||
Reference in New Issue
Block a user