@cryptotaxi247 / kubo / commits / bb8886f3a

merkledag: LONG timeout on Get

we shouldn't use an arbitrary timeout here. since Get doesnt take in a context yet, we give a large upper bound. think of an http request. we want it to go on as long as the client requests it.

Juan Batiz-Benet committed Jan 3, 2015 at 06:16 UTC bb8886f3afdd5afc7a96f9420ef09b9afed7468c
1 file changed +5 -1
merkledag/merkledag.go
+5 -1
@@ -229,7 +229,11 @@ func (n *dagService) Get(k u.Key) (*Node, error) {
229 return nil, fmt.Errorf("dagService is nil")
230 }
231
232 - ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)
232 + ctx, _ := context.WithTimeout(context.TODO(), time.Minute)
233 + // we shouldn't use an arbitrary timeout here.
234 + // since Get doesnt take in a context yet, we give a large upper bound.
235 + // think of an http request. we want it to go on as long as the client requests it.
236 +
237 b, err := n.Blocks.GetBlock(ctx, k)
238 if err != nil {
239 return nil, err