Commit 4bcfe094 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

extract constants

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 0545c4d1
......@@ -29,6 +29,7 @@ const (
maxProvidersPerRequest = 3
providerRequestTimeout = time.Second * 10
hasBlockTimeout = time.Second * 15
sizeBatchRequestChan = 32
)
var (
......@@ -59,7 +60,7 @@ func New(parent context.Context, p peer.Peer, network bsnet.BitSwapNetwork, rout
routing: routing,
sender: network,
wantlist: wantlist.NewThreadSafe(),
batchRequests: make(chan []u.Key, 32),
batchRequests: make(chan []u.Key, sizeBatchRequestChan),
}
network.SetDelegate(bs)
go bs.clientWorker(ctx)
......
......@@ -13,6 +13,10 @@ import (
var log = u.Logger("engine")
const (
sizeOutboxChan = 4
)
// Envelope contains a message for a Peer
type Envelope struct {
// Peer is the intended recipient
......@@ -43,7 +47,7 @@ func NewEngine(ctx context.Context, bs bstore.Blockstore) *Engine {
ledgerMap: make(map[u.Key]*ledger),
bs: bs,
peerRequestQueue: newTaskQueue(),
outbox: make(chan Envelope, 4), // TODO extract constant
outbox: make(chan Envelope, sizeOutboxChan),
workSignal: make(chan struct{}),
}
go e.taskWorker(ctx)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment