Ionosphere.tv
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: handle PayloadTooLargeError in talk publishing

When a talk's assembled document exceeds PDS body limits, re-publish
the talk without the document rather than crashing the entire pipeline.
The document will be rebuilt from layers.pub records by the indexer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+41 -17
+41 -17
apps/ionosphere-appview/src/publish.ts
··· 126 126 docCount++; 127 127 } 128 128 129 - await pds.putRecord("tv.ionosphere.talk", talk.rkey, { 130 - $type: "tv.ionosphere.talk", 131 - title: talk.title, 132 - ...(document && { document }), 133 - ...(eventUri && { eventUri }), 134 - ...(speakerUris.length > 0 && { speakerUris }), 135 - ...(talk.video_uri && { videoUri: talk.video_uri }), 136 - ...(talk.video_offset_ns && { videoOffsetNs: talk.video_offset_ns }), 137 - ...(talk.schedule_uri && { scheduleUri: talk.schedule_uri }), 138 - ...(talk.room && { room: talk.room }), 139 - ...(talk.category && { category: talk.category }), 140 - ...(talk.talk_type && { talkType: talk.talk_type }), 141 - ...(talk.starts_at && { startsAt: talk.starts_at }), 142 - ...(talk.ends_at && { endsAt: talk.ends_at }), 143 - ...(talk.duration && { duration: talk.duration }), 144 - ...(talk.description && { description: talk.description }), 145 - }); 129 + try { 130 + await pds.putRecord("tv.ionosphere.talk", talk.rkey, { 131 + $type: "tv.ionosphere.talk", 132 + title: talk.title, 133 + ...(document && { document }), 134 + ...(eventUri && { eventUri }), 135 + ...(speakerUris.length > 0 && { speakerUris }), 136 + ...(talk.video_uri && { videoUri: talk.video_uri }), 137 + ...(talk.video_offset_ns && { videoOffsetNs: talk.video_offset_ns }), 138 + ...(talk.schedule_uri && { scheduleUri: talk.schedule_uri }), 139 + ...(talk.room && { room: talk.room }), 140 + ...(talk.category && { category: talk.category }), 141 + ...(talk.talk_type && { talkType: talk.talk_type }), 142 + ...(talk.starts_at && { startsAt: talk.starts_at }), 143 + ...(talk.ends_at && { endsAt: talk.ends_at }), 144 + ...(talk.duration && { duration: talk.duration }), 145 + ...(talk.description && { description: talk.description }), 146 + }); 147 + } catch (err: any) { 148 + if (err?.status === 413) { 149 + console.warn(` ⚠ Talk ${talk.rkey}: payload too large, publishing without document`); 150 + await pds.putRecord("tv.ionosphere.talk", talk.rkey, { 151 + $type: "tv.ionosphere.talk", 152 + title: talk.title, 153 + ...(eventUri && { eventUri }), 154 + ...(speakerUris.length > 0 && { speakerUris }), 155 + ...(talk.video_uri && { videoUri: talk.video_uri }), 156 + ...(talk.video_offset_ns && { videoOffsetNs: talk.video_offset_ns }), 157 + ...(talk.schedule_uri && { scheduleUri: talk.schedule_uri }), 158 + ...(talk.room && { room: talk.room }), 159 + ...(talk.category && { category: talk.category }), 160 + ...(talk.talk_type && { talkType: talk.talk_type }), 161 + ...(talk.starts_at && { startsAt: talk.starts_at }), 162 + ...(talk.ends_at && { endsAt: talk.ends_at }), 163 + ...(talk.duration && { duration: talk.duration }), 164 + ...(talk.description && { description: talk.description }), 165 + }); 166 + } else { 167 + throw err; 168 + } 169 + } 146 170 } 147 171 console.log(` ${docCount} talks with assembled documents.`); 148 172 console.log(` Done.`);