mirror of
https://github.com/dergigi/boris.git
synced 2026-01-21 07:44:56 +01:00
perf(bunker): make NIP-46 publish non-blocking at app wiring level; resolve immediately and let responses drive timing/results
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -195,9 +195,17 @@ function App() {
|
||||
// Create relay pool and set it up BEFORE loading accounts
|
||||
// NostrConnectAccount.fromJSON needs this to restore the signer
|
||||
const pool = new RelayPool()
|
||||
// Wire the signer to use this pool's publish/subscription methods (per applesauce examples)
|
||||
// Wire the signer to use this pool; make publish non-blocking so callers don't
|
||||
// wait for every relay send to finish. Responses still resolve the pending request.
|
||||
NostrConnectSigner.subscriptionMethod = pool.subscription.bind(pool)
|
||||
NostrConnectSigner.publishMethod = pool.publish.bind(pool)
|
||||
NostrConnectSigner.publishMethod = (relays: string[], event: unknown) => {
|
||||
const result: any = pool.publish(relays, event as any)
|
||||
if (result && typeof (result as any).subscribe === 'function') {
|
||||
try { (result as any).subscribe({ complete: () => {}, error: () => {} }) } catch {}
|
||||
}
|
||||
// Return an already-resolved promise so upstream await finishes immediately
|
||||
return Promise.resolve()
|
||||
}
|
||||
console.log('[bunker] ✅ Wired NostrConnectSigner to RelayPool publish/subscription (before account load)')
|
||||
|
||||
// Create a relay group for better event deduplication and management
|
||||
|
||||
Reference in New Issue
Block a user