mirror of
https://github.com/asmogo/nws.git
synced 2025-01-18 10:01:33 +00:00
Refactor goroutine sleep order
This commit is contained in:
parent
2ccb01f1f3
commit
16277358fe
@ -13,19 +13,16 @@ func (e *Exit) announceExitNode(ctx context.Context) error {
|
|||||||
if !e.config.Public {
|
if !e.config.Public {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Second * 10)
|
|
||||||
// create update event
|
|
||||||
// create a event
|
|
||||||
|
|
||||||
event := nostr.Event{
|
event := nostr.Event{
|
||||||
PubKey: e.publicKey,
|
PubKey: e.publicKey,
|
||||||
CreatedAt: nostr.Now(),
|
CreatedAt: nostr.Now(),
|
||||||
Kind: nostr.KindTextNote,
|
Kind: nostr.KindTextNote,
|
||||||
Content: "",
|
Tags: nostr.Tags{
|
||||||
Tags: nostr.Tags{nostr.Tag{"n", "nws"}, nostr.Tag{"expiration", strconv.FormatInt(time.Now().Add(time.Second*10).Unix(), 20)}},
|
nostr.Tag{"n", "nws"},
|
||||||
|
nostr.Tag{"expiration", strconv.FormatInt(time.Now().Add(time.Second*10).Unix(), 20)},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err := event.Sign(e.config.NostrPrivateKey)
|
err := event.Sign(e.config.NostrPrivateKey)
|
||||||
@ -41,9 +38,9 @@ func (e *Exit) announceExitNode(ctx context.Context) error {
|
|||||||
// do not return here, try to publish the event to other relays
|
// do not return here, try to publish the event to other relays
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user