diff --git a/src/controllers/nostr/relay.ts b/src/controllers/nostr/relay.ts index 6fc08d0..5d08e02 100644 --- a/src/controllers/nostr/relay.ts +++ b/src/controllers/nostr/relay.ts @@ -63,8 +63,14 @@ function connectStream(socket: WebSocket) { const store = await Storages.db(); const pubsub = await Storages.pubsub(); - for (const event of await store.query(filters, { limit: FILTER_LIMIT })) { - send(['EVENT', subId, event]); + try { + for (const event of await store.query(filters, { limit: FILTER_LIMIT })) { + send(['EVENT', subId, event]); + } + } catch (e) { + send(['CLOSED', subId, e.message]); + controllers.delete(subId); + return; } send(['EOSE', subId]);