-
Notifications
You must be signed in to change notification settings - Fork 773
bugfix: retry multi times if failed to report pieces #1185
Conversation
f9b1784
to
8075038
Compare
Codecov Report
@@ Coverage Diff @@
## master #1185 +/- ##
==========================================
- Coverage 47.66% 47.54% -0.13%
==========================================
Files 115 115
Lines 7225 7240 +15
==========================================
- Hits 3444 3442 -2
- Misses 3508 3524 +16
- Partials 273 274 +1
Continue to review full report at Codecov.
|
} | ||
|
||
var retry = 0 | ||
var maxRetryTime = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following codes will send request to supernode at most 4 times, is it expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
break | ||
} | ||
|
||
sleepTime := time.Duration(rand.Intn(1000)+500) * time.Millisecond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The time to sleep is a bit long. It's better to decrease the interval time of first retry. How about [50, 500]ms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE.
8075038
to
b7ec36e
Compare
Signed-off-by: Starnop <[email protected]>
b7ec36e
to
5d248de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Starnop [email protected]
Ⅰ. Describe what this PR did
Sometimes dfget will fail to report pieces to supernode for some reason, such as supernode cannot handle it. And then supernode will mark that this task has not been completed forever. That's not expected. So we should add a retry mechanism to reduce the chance of errors.
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews