Skip to content

Commit

Permalink
chore: don't fail the scheduled worker with missing sites
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbo committed Nov 13, 2024
1 parent d939a74 commit 2a12ed7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 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(
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 2a12ed7

Please sign in to comment.