mirror of
https://github.com/bitvora/wot-relay.git
synced 2025-06-06 18:31:05 +00:00
Merge pull request #43 from bitvora/dev-fixFJMistakes
add context to goroutine
This commit is contained in:
commit
aaa0047a74
6
main.go
6
main.go
@ -356,15 +356,15 @@ func archiveTrustedNotes(ctx context.Context, relay *khatru.Relay) {
|
|||||||
log.Println("📦 archiving trusted notes...")
|
log.Println("📦 archiving trusted notes...")
|
||||||
|
|
||||||
for ev := range pool.SubMany(timeout, seedRelays, filters) {
|
for ev := range pool.SubMany(timeout, seedRelays, filters) {
|
||||||
go archiveEvent(relay, *ev.Event)
|
go archiveEvent(ctx, relay, *ev.Event)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("📦 archived", trustedNotes, "trusted notes and discarded ", untrustedNotes, "untrusted notes")
|
log.Println("📦 archived", trustedNotes, "trusted notes and discarded ", untrustedNotes, "untrusted notes")
|
||||||
}
|
}
|
||||||
|
|
||||||
func archiveEvent(relay *khatru.Relay, ev nostr.Event) {
|
func archiveEvent(ctx context.Context, relay *khatru.Relay, ev nostr.Event) {
|
||||||
if trustNetworkMap[ev.PubKey] {
|
if trustNetworkMap[ev.PubKey] {
|
||||||
wdb.Publish(context.Background(), ev)
|
wdb.Publish(ctx, ev)
|
||||||
relay.BroadcastEvent(&ev)
|
relay.BroadcastEvent(&ev)
|
||||||
trustedNotes++
|
trustedNotes++
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user