From 7680133e172dc34d72a3aa88f992a3ca7df64ddc Mon Sep 17 00:00:00 2001 From: Keenan Nemetz Date: Thu, 20 Jun 2024 09:50:53 -0700 Subject: [PATCH] use session for dag sync --- net/server.go | 15 --------------- net/sync_dag.go | 3 +++ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/net/server.go b/net/server.go index 9e09164b37..413f391064 100644 --- a/net/server.go +++ b/net/server.go @@ -337,18 +337,3 @@ func peerIDFromContext(ctx context.Context) (libpeer.ID, error) { } return pid, nil } - -// KEEPING AS REFERENCE -// -// logFromProto returns a thread log from a proto log. -// func logFromProto(l *pb.Log) thread.LogInfo { -// return thread.LogInfo{ -// ID: l.ID.ID, -// PubKey: l.PubKey.PubKey, -// Addrs: addrsFromProto(l.Addrs), -// Head: thread.Head{ -// ID: l.Head.Cid, -// Counter: l.Counter, -// }, -// } -// } diff --git a/net/sync_dag.go b/net/sync_dag.go index 6e9801ebd7..c15ebb7552 100644 --- a/net/sync_dag.go +++ b/net/sync_dag.go @@ -43,7 +43,10 @@ func syncDAG(ctx context.Context, bserv blockservice.BlockService, block *corebl ctx, cancel := context.WithTimeout(ctx, syncDAGTimeout) defer cancel() + // use a session to make remote fetches more efficient + ctx = blockservice.ContextWithSession(ctx, bserv) store := &bsrvadapter.Adapter{Wrapped: bserv} + lsys := cidlink.DefaultLinkSystem() lsys.SetWriteStorage(store) lsys.SetReadStorage(store)