@cryptotaxi247 / kubo / commits / 996691b2f

feat(pin): return err when ctx.Done

License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>

Overbool committed Sep 14, 2018 at 09:07 UTC 996691b2f401e45e3252eb4dc2d6d790723a6c17
1 file changed +5
pin/gc/gc.go
+5
@@ -193,6 +193,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo
193 select {
194 case output <- Result{Error: &CannotFetchLinksError{cid, err}}:
195 case <-ctx.Done():
196 + return nil, ctx.Err()
197 }
198 }
199 return links, nil
@@ -203,6 +204,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo
204 select {
205 case output <- Result{Error: err}:
206 case <-ctx.Done():
207 + return nil, ctx.Err()
208 }
209 }
210
@@ -213,6 +215,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo
215 select {
216 case output <- Result{Error: &CannotFetchLinksError{cid, err}}:
217 case <-ctx.Done():
218 + return nil, ctx.Err()
219 }
220 }
221 return links, nil
@@ -223,6 +226,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo
226 select {
227 case output <- Result{Error: err}:
228 case <-ctx.Done():
229 + return nil, ctx.Err()
230 }
231 }
232
@@ -236,6 +240,7 @@ func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffo
240 select {
241 case output <- Result{Error: err}:
242 case <-ctx.Done():
243 + return nil, ctx.Err()
244 }
245 }
246