Skip to content

Commit

Permalink
rapide: fix: make unexpected blocks a retriable error
Browse files Browse the repository at this point in the history
In 719b5e6 I changed `download.expand` to release the node lock before returning.
This allows other workers to access the just expanded node while we walk up the chain ancestry.
This mean that when we relock the node later to add it to our list of tasks, someone else may have downloaded some of the blocks already and thus they are not in the childrens slice and thus we wont add them to our list.

This also solve the case where you give a Traversal that is not supported by the underlying protocol,
in that case we want to kill the current download and retry deeper, while previously we would hard error on this and kill the worker.
  • Loading branch information
Jorropo committed Feb 3, 2023
1 parent 93aabfe commit 74a2a52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rapide/serverdriven.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (w *serverDrivenWorker) work(ctx context.Context) {

err := w.doOneDownload(ctx, workCid, traversal)
switch err {
case nil, io.EOF, errGotDoneBlock:
case nil, io.EOF, errGotDoneBlock, errGotUnexpectedBlock:
w.resetCurrentChildsNodeWorkState()
continue
default:
Expand Down

0 comments on commit 74a2a52

Please sign in to comment.