From 48d75efafd9fee501447c879804d1ac44c06476f Mon Sep 17 00:00:00 2001 From: Sandra Larsson Date: Wed, 27 Nov 2024 14:22:25 +0100 Subject: [PATCH] fix: bug fix rendering engine restart (#106) --- src/api/manager/workflow.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/api/manager/workflow.ts b/src/api/manager/workflow.ts index 5c4a77e3..0a0fe130 100644 --- a/src/api/manager/workflow.ts +++ b/src/api/manager/workflow.ts @@ -342,11 +342,31 @@ export async function stopProduction( ); if (productionHasRenderingEngineSources) { + const ingestPipelineUuids = (await getPipelines()).map( + (pipeline) => pipeline.uuid + ); + for (const pipeline of production.production_settings.pipelines) { const pipelineId = pipeline.pipeline_id; - if (pipelineId) { - const htmlSources = await getPipelineRenderingEngineHtml(pipelineId); - const mediaSources = await getPipelineRenderingEngineMedia(pipelineId); + + // Make sure pipeline ID exists before attempting to get rendering engine + const pipelineIdExists = pipelineId + ? ingestPipelineUuids.includes(pipelineId) + : false; + + if (pipelineId && pipelineIdExists) { + const htmlSources = await getPipelineRenderingEngineHtml( + pipelineId + ).catch((error) => { + Log().error('Failed to fetch HTML sources from pipeline: ', error); + return []; + }); + const mediaSources = await getPipelineRenderingEngineMedia( + pipelineId + ).catch((error) => { + Log().error('Failed to fetch Media sources from pipeline: ', error); + return []; + }); if (htmlSources.length > 0 && htmlSources) { for (const pipeline of production.production_settings.pipelines) {