mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor(scavenger): put SQL insert into try-catch block
This commit is contained in:
parent
1b30f10a9f
commit
771d7f79db
1 changed files with 11 additions and 7 deletions
|
|
@ -36,13 +36,17 @@ async function handleEvent9735(kysely: Kysely<DittoTables>, event: NostrEvent) {
|
||||||
const zappedEventId = zapRequest.tags.find(([name]) => name === 'e')?.[1];
|
const zappedEventId = zapRequest.tags.find(([name]) => name === 'e')?.[1];
|
||||||
if (!zappedEventId) return;
|
if (!zappedEventId) return;
|
||||||
|
|
||||||
await kysely.insertInto('event_zaps').values({
|
try {
|
||||||
receipt_id: event.id,
|
await kysely.insertInto('event_zaps').values({
|
||||||
target_event_id: zappedEventId,
|
receipt_id: event.id,
|
||||||
sender_pubkey: zapRequest.pubkey,
|
target_event_id: zappedEventId,
|
||||||
amount_millisats,
|
sender_pubkey: zapRequest.pubkey,
|
||||||
comment: zapRequest.content,
|
amount_millisats,
|
||||||
}).execute();
|
comment: zapRequest.content,
|
||||||
|
}).execute();
|
||||||
|
} catch {
|
||||||
|
// receipt_id is unique, do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { scavengerEvent };
|
export { scavengerEvent };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue