Skip to content

Commit 80fbf61

Browse files
committed
chore: don't fail the scheduled worker with missing sites
1 parent d939a74 commit 80fbf61

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

api/workers/jobProcessors/buildTasksScheduler.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ async function buildTasksScheduler(job) {
2828
const tasksToQueue = await Promise.all(
2929
siteBuildTasks.map(async (siteBuildTask) => {
3030
// always use the branch config with site context
31-
const { branch } = siteBuildTask.Site.SiteBranchConfigs.find(
32-
(sbc) => sbc.context === 'site',
33-
);
31+
const { branch } =
32+
siteBuildTask.Site?.SiteBranchConfigs?.find((sbc) => sbc.context === 'site') ||
33+
{};
34+
35+
if (!branch) return Promise.resolve(null);
36+
3437
// find the latest build matching this branch
3538
// https://github.com/sequelize/sequelize/issues/7665
3639
const builds = await Build.findAll({

0 commit comments

Comments
 (0)