Compare commits
6 commits
eb0278a82c
...
c4edcb114d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4edcb114d | ||
|
|
2a546180f0 | ||
|
|
78d5ff61a6 | ||
|
|
7a7b995b5c | ||
|
|
b5d192b9fb | ||
|
|
db35459de5 |
1 changed files with 13 additions and 17 deletions
|
|
@ -205,24 +205,20 @@ export class NostrPool {
|
|||
const log = getLogger({ appName: keys.name })
|
||||
this.log(`📤 Publishing Kind ${event.kind} event to ${relays.length} relay(s): ${relays.join(', ')}`)
|
||||
const pool = new SimplePool()
|
||||
try {
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
}
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
}
|
||||
} finally {
|
||||
pool.close(relays)
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue