Skip to content

Commit

Permalink
Merge pull request #4662 from cloud-gov/chore-build-task-worker-impro…
Browse files Browse the repository at this point in the history
…vements

don't fail the scheduled worker with missing sites
  • Loading branch information
drewbo authored Nov 13, 2024
2 parents d939a74 + 80fbf61 commit f448c36
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/workers/jobProcessors/buildTasksScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ async function buildTasksScheduler(job) {
const tasksToQueue = await Promise.all(
siteBuildTasks.map(async (siteBuildTask) => {
// always use the branch config with site context
const { branch } = siteBuildTask.Site.SiteBranchConfigs.find(
(sbc) => sbc.context === 'site',
);
const { branch } =
siteBuildTask.Site?.SiteBranchConfigs?.find((sbc) => sbc.context === 'site') ||
{};

if (!branch) return Promise.resolve(null);

// find the latest build matching this branch
// https://github.com/sequelize/sequelize/issues/7665
const builds = await Build.findAll({
Expand Down

0 comments on commit f448c36

Please sign in to comment.