Skip to content

Commit

Permalink
Merge pull request #7069 from HenrikJannsen/improve-handling-of-MAX_R…
Browse files Browse the repository at this point in the history
…EPEATED_REQUESTS

Increase MAX_REPEATED_REQUESTS
  • Loading branch information
alejandrogarcia83 authored Apr 9, 2024
2 parents 92283de + 31ce213 commit 54b75ce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
private static int NUM_SEEDS_FOR_PRELIMINARY_REQUEST = 2;
// how many seeds additional to the first responding PreliminaryGetDataRequest seed we request the GetUpdatedDataRequest from
private static int NUM_ADDITIONAL_SEEDS_FOR_UPDATE_REQUEST = 1;
private static int MAX_REPEATED_REQUESTS = 30;
private boolean isPreliminaryDataRequest = true;


Expand Down Expand Up @@ -140,6 +141,7 @@ public RequestDataManager(NetworkNode networkNode,
if (seedNodeRepository.isSeedNode(myAddress)) {
NUM_SEEDS_FOR_PRELIMINARY_REQUEST = 3;
NUM_ADDITIONAL_SEEDS_FOR_UPDATE_REQUEST = 2;
MAX_REPEATED_REQUESTS = 100;
}
}
});
Expand Down Expand Up @@ -361,7 +363,7 @@ public void onComplete(boolean wasTruncated) {
}

if (wasTruncated) {
if (numRepeatedRequests < 20) {
if (numRepeatedRequests < MAX_REPEATED_REQUESTS) {
// If we had allDataReceived already set to true but get a response with truncated flag,
// we still repeat the request to that node for higher redundancy. Otherwise, one seed node
// providing incomplete data would stop others to fill the gaps.
Expand Down

0 comments on commit 54b75ce

Please sign in to comment.