Skip to content

Commit

Permalink
use session for dag sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nasdf committed Jun 20, 2024
1 parent aeec15d commit 7680133
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
15 changes: 0 additions & 15 deletions net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
// },
// }
// }
3 changes: 3 additions & 0 deletions net/sync_dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7680133

Please sign in to comment.