Skip to content

Commit

Permalink
Small refactoring fo common runner
Browse files Browse the repository at this point in the history
  • Loading branch information
melikhov-dev committed Jan 10, 2025
1 parent e0279aa commit 9cda507
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/server/components/charts-engine/runners/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ function engineProcessingCallback({
res.setHeader('chart-runner-type', runnerType);

if (result) {
// TODO use ShowChartsEngineDebugInfo flag
if ('logs_v2' in result && (!res.locals.editMode || !showChartsEngineDebugInfo)) {
if (
'logs_v2' in result &&
(!processorParams.isEditMode || !showChartsEngineDebugInfo)
) {
delete result.logs_v2;
}

Expand Down Expand Up @@ -141,9 +143,6 @@ function engineProcessingCallback({

res.status(error.statusCode || 500).send(result);
}
})
.finally(() => {
ctx.end();
});
}

Expand Down Expand Up @@ -297,7 +296,9 @@ export function commonRunner({
})
.catch((error) => {
ctx.logError('CHARTS_ENGINE_PROCESSOR_UNHANDLED_ERROR', error);
ctx.end();
res.status(500).send('Internal error');
})
.finally(() => {
ctx.end();
});
}

0 comments on commit 9cda507

Please sign in to comment.