sdk: simplified dataloader event more. should be faster.
This commit is contained in:
@@ -33,8 +33,10 @@ func (sys *System) createAddressableDataloader(kind int) *dataloader.Loader[stri
|
||||
func(ctxs []context.Context, pubkeys []string) map[string]dataloader.Result[[]*nostr.Event] {
|
||||
return sys.batchLoadAddressableEvents(ctxs, kind, pubkeys)
|
||||
},
|
||||
dataloader.WithBatchCapacity[string, []*nostr.Event](30),
|
||||
dataloader.WithWait[string, []*nostr.Event](time.Millisecond*350),
|
||||
dataloader.Options{
|
||||
Wait: time.Millisecond * 110,
|
||||
MaxThreshold: 30,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -56,7 +58,8 @@ func (sys *System) batchLoadAddressableEvents(
|
||||
waiting := len(pubkeys)
|
||||
|
||||
for i, pubkey := range pubkeys {
|
||||
ctx := ctxs[i]
|
||||
ctx, cancel := context.WithCancel(ctxs[i])
|
||||
defer cancel()
|
||||
|
||||
// build batched queries for the external relays
|
||||
go func(i int, pubkey string) {
|
||||
|
||||
Reference in New Issue
Block a user