File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ import { Relay } from './relay.ts'
1616export type SubCloser = { close : ( reason ?: string ) => void }
1717
1818export type AbstractPoolConstructorOptions = AbstractRelayConstructorOptions & {
19- // automaticallyAuth takes a relay URL and should return null
20- // in case that relay shouldn't be authenticated against
19+ // automaticallyAuth takes a relay URL and should return null in case that relay shouldn't be authenticated against
2120 // or a function to sign the AUTH event template otherwise (that function may still throw in case of failure)
2221 automaticallyAuth ?: ( relayURL : string ) => null | ( ( event : EventTemplate ) => Promise < VerifiedEvent > )
2322 // onRelayConnectionFailure is called with the URL of a relay that failed the initial connection
@@ -269,10 +268,13 @@ export class AbstractSimplePool {
269268 filter : Filter ,
270269 params : Pick < SubscribeManyParams , 'label' | 'id' | 'onevent' | 'onclose' | 'maxWait' | 'onauth' > ,
271270 ) : SubCloser {
272- const subcloser = this . subscribe ( relays , filter , {
271+ let subcloser : SubCloser
272+ subcloser = this . subscribe ( relays , filter , {
273273 ...params ,
274274 oneose ( ) {
275- subcloser . close ( 'closed automatically on eose' )
275+ const reason = 'closed automatically on eose'
276+ if ( subcloser ) subcloser . close ( reason )
277+ else params . onclose ?.( relays . map ( _ => reason ) )
276278 } ,
277279 } )
278280 return subcloser
Original file line number Diff line number Diff line change 11{
22 "name" : " @nostr/tools" ,
3- "version" : " 2.23.0 " ,
3+ "version" : " 2.23.1 " ,
44 "exports" : {
55 "." : " ./index.ts" ,
66 "./core" : " ./core.ts" ,
Original file line number Diff line number Diff line change 11{
22 "type" : " module" ,
33 "name" : " nostr-tools" ,
4- "version" : " 2.23.0 " ,
4+ "version" : " 2.23.1 " ,
55 "description" : " Tools for making a Nostr client." ,
66 "repository" : {
77 "type" : " git" ,
You can’t perform that action at this time.
0 commit comments