feat: use plainRun to abort run

This commit is contained in:
karishmas6
2024-10-10 02:40:52 +05:30
parent 079110edca
commit de200220d3

View File

@@ -357,9 +357,9 @@ router.post('/runs/abort/:id', requireSignIn, async (req, res) => {
if (!run) { if (!run) {
return res.status(404).send(false); return res.status(404).send(false);
} }
//const parsedRun = JSON.parse(run); const plainRun = run.toJSON();
const browser = browserPool.getRemoteBrowser(run.browserId); const browser = browserPool.getRemoteBrowser(plainRun.browserId);
const currentLog = browser?.interpreter.debugMessages.join('/n'); const currentLog = browser?.interpreter.debugMessages.join('/n');
const serializableOutput = browser?.interpreter.serializableData.reduce((reducedObject, item, index) => { const serializableOutput = browser?.interpreter.serializableData.reduce((reducedObject, item, index) => {
return { return {
@@ -377,7 +377,7 @@ router.post('/runs/abort/:id', requireSignIn, async (req, res) => {
...run, ...run,
status: 'aborted', status: 'aborted',
finishedAt: new Date().toLocaleString(), finishedAt: new Date().toLocaleString(),
browserId: run.browserId, browserId: plainRun.browserId,
log: currentLog, log: currentLog,
serializableOutput, serializableOutput,
binaryOutput, binaryOutput,