pipeline: catch error on broadcast

This commit is contained in:
Alex Gleason 2024-02-02 14:51:22 -06:00
parent 7b7cd8b15c
commit e9d29075eb
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 6 additions and 2 deletions

View File

@ -225,11 +225,15 @@ function streamOut(event: NostrEvent) {
* Publish the event to other relays.
* This should only be done in certain circumstances, like mentioning a user or publishing deletions.
*/
function broadcast(event: DittoEvent, signal: AbortSignal) {
async function broadcast(event: DittoEvent, signal: AbortSignal) {
if (!event.user || !isFresh(event)) return;
if (event.kind === 5) {
client.event(event, { signal });
try {
await client.event(event, { signal });
} catch (e) {
debug(e);
}
}
}