fix round robin and reduce num empty spins to improve perf
This commit is contained in:
parent
fab3d42ee9
commit
e86a1ed56d
@ -73,8 +73,8 @@ std::vector<ChunkPicker::ContentChunkR> ChunkPicker::updateChunkRequests(
|
|||||||
assert(objreg.valid(participating_in_last));
|
assert(objreg.valid(participating_in_last));
|
||||||
|
|
||||||
auto it = participating_unfinished.find(participating_in_last);
|
auto it = participating_unfinished.find(participating_in_last);
|
||||||
// hard limit robin rounds to array size time 100
|
// hard limit robin rounds to array size time 20
|
||||||
for (size_t i = 0; req_ret.size() < num_requests && i < participating_unfinished.size()*100; i++) {
|
for (size_t i = 0; req_ret.size() < num_requests && i < participating_unfinished.size()*20; i++) {
|
||||||
if (it == participating_unfinished.end()) {
|
if (it == participating_unfinished.end()) {
|
||||||
it = participating_unfinished.begin();
|
it = participating_unfinished.begin();
|
||||||
}
|
}
|
||||||
@ -172,6 +172,12 @@ std::vector<ChunkPicker::ContentChunkR> ChunkPicker::updateChunkRequests(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (it == participating_unfinished.end()) {
|
||||||
|
participating_in_last = entt::null;
|
||||||
|
} else {
|
||||||
|
participating_in_last = it->first;
|
||||||
|
}
|
||||||
|
|
||||||
if (req_ret.size() < num_requests) {
|
if (req_ret.size() < num_requests) {
|
||||||
std::cerr << "CP: could not fulfil, " << group_number << ":" << peer_number << " only has " << req_ret.size() << " candidates\n";
|
std::cerr << "CP: could not fulfil, " << group_number << ":" << peer_number << " only has " << req_ret.size() << " candidates\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user