mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 00:59:07 -04:00
close relay websockets cleanly.
This commit is contained in:
parent
637b9440ef
commit
a30f422d7d
6
event.go
6
event.go
|
@ -108,6 +108,12 @@ example:
|
|||
}
|
||||
}
|
||||
|
||||
defer func() {
|
||||
for _, relay := range relays {
|
||||
relay.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
// gather the secret key
|
||||
sec, err := gatherSecretKeyFromArguments(c)
|
||||
if err != nil {
|
||||
|
|
10
fetch.go
10
fetch.go
|
@ -24,6 +24,15 @@ var fetch = &cli.Command{
|
|||
},
|
||||
ArgsUsage: "[nip19code]",
|
||||
Action: func(c *cli.Context) error {
|
||||
pool := nostr.NewSimplePool(c.Context)
|
||||
|
||||
defer func() {
|
||||
pool.Relays.Range(func(_ string, relay *nostr.Relay) bool {
|
||||
relay.Close()
|
||||
return true
|
||||
})
|
||||
}()
|
||||
|
||||
for code := range getStdinLinesOrFirstArgument(c) {
|
||||
filter := nostr.Filter{}
|
||||
|
||||
|
@ -67,7 +76,6 @@ var fetch = &cli.Command{
|
|||
authorHint = v
|
||||
}
|
||||
|
||||
pool := nostr.NewSimplePool(c.Context)
|
||||
if authorHint != "" {
|
||||
relayList := sdk.FetchRelaysForPubkey(c.Context, pool, authorHint,
|
||||
"wss://purplepag.es", "wss://relay.damus.io", "wss://relay.noswhere.com",
|
||||
|
|
Loading…
Reference in New Issue
Block a user