Skip to content

Commit

Permalink
Merge pull request #43 from bitvora/dev-fixFJMistakes
Browse files Browse the repository at this point in the history
add context to goroutine
  • Loading branch information
barrydeen authored Sep 13, 2024
2 parents 1db8134 + 02fc217 commit aaa0047
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ func archiveTrustedNotes(ctx context.Context, relay *khatru.Relay) {
log.Println("📦 archiving trusted notes...")

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")
}

func archiveEvent(relay *khatru.Relay, ev nostr.Event) {
func archiveEvent(ctx context.Context, relay *khatru.Relay, ev nostr.Event) {
if trustNetworkMap[ev.PubKey] {
wdb.Publish(context.Background(), ev)
wdb.Publish(ctx, ev)
relay.BroadcastEvent(&ev)
trustedNotes++
} else {
Expand Down

0 comments on commit aaa0047

Please sign in to comment.