mirror of
https://github.com/logos-messaging/go-libp2p-rendezvous.git
synced 2026-01-07 23:33:10 +00:00
client: use larger batch in discovery, only poll immediately if full
This commit is contained in:
parent
6c1d28214b
commit
8181424229
@ -180,7 +180,7 @@ func discoverAsync(ctx context.Context, ns string, s inet.Stream, ch chan Regist
|
|||||||
r := ggio.NewDelimitedReader(s, inet.MessageSizeMax)
|
r := ggio.NewDelimitedReader(s, inet.MessageSizeMax)
|
||||||
w := ggio.NewDelimitedWriter(s)
|
w := ggio.NewDelimitedWriter(s)
|
||||||
|
|
||||||
const batch = 100
|
const batch = 200
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cookie []byte
|
cookie []byte
|
||||||
@ -203,7 +203,7 @@ func discoverAsync(ctx context.Context, ns string, s inet.Stream, ch chan Regist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(regs) < batch/2 {
|
if len(regs) < batch {
|
||||||
select {
|
select {
|
||||||
case <-time.After(2 * time.Minute):
|
case <-time.After(2 * time.Minute):
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user