mirror of
https://github.com/bitvora/wot-relay.git
synced 2025-05-24 11:02:01 +00:00
putting back goroutines like i had them before fj told me to remove it then put it back
This commit is contained in:
parent
95efd8247a
commit
51d8a6e6f0
22
main.go
22
main.go
@ -356,18 +356,18 @@ 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) {
|
||||||
if trustNetworkMap[ev.PubKey] {
|
go archiveEvent(relay, *ev.Event)
|
||||||
if len(ev.Tags) > 3000 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
wdb.Publish(ctx, *ev.Event)
|
|
||||||
relay.BroadcastEvent(ev.Event)
|
|
||||||
trustedNotes++
|
|
||||||
} else {
|
|
||||||
untrustedNotes++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
if trustNetworkMap[ev.PubKey] {
|
||||||
|
wdb.Publish(context.Background(), ev)
|
||||||
|
relay.BroadcastEvent(&ev)
|
||||||
|
trustedNotes++
|
||||||
|
} else {
|
||||||
|
untrustedNotes++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user