Add basic protectiong from cyclic successful file reference repair.
GitOrigin-RevId: f0d3ef24dc95ed1f5ed06801abc435ee40c80f01
This commit is contained in:
parent
9fa88eb0ec
commit
6b001fedd9
@ -201,6 +201,14 @@ void FileReferenceManager::run_node(NodeId node_id) {
|
|||||||
node.query = {};
|
node.query = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (node.last_successful_repair_time >= Time::now() - 60) {
|
||||||
|
VLOG(file_references) << "Recently repaired file reference for file " << node_id << ", do not try again";
|
||||||
|
for (auto &p : node.query->promises) {
|
||||||
|
p.set_error(Status::Error(429, "Too Many Requests: retry after 60"));
|
||||||
|
}
|
||||||
|
node.query = {};
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto file_source_id = node.file_source_ids.next();
|
auto file_source_id = node.file_source_ids.next();
|
||||||
send_query({node_id, node.query->generation}, file_source_id);
|
send_query({node_id, node.query->generation}, file_source_id);
|
||||||
}
|
}
|
||||||
@ -313,6 +321,7 @@ FileReferenceManager::Destination FileReferenceManager::on_query_result(Destinat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status.is_ok()) {
|
if (status.is_ok()) {
|
||||||
|
node.last_successful_repair_time = Time::now();
|
||||||
for (auto &p : query->promises) {
|
for (auto &p : query->promises) {
|
||||||
p.set_value(Unit());
|
p.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ class FileReferenceManager : public Actor {
|
|||||||
struct Node {
|
struct Node {
|
||||||
SetWithPosition<FileSourceId> file_source_ids;
|
SetWithPosition<FileSourceId> file_source_ids;
|
||||||
unique_ptr<Query> query;
|
unique_ptr<Query> query;
|
||||||
|
double last_successful_repair_time = -1e10;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileSourceMessage {
|
struct FileSourceMessage {
|
||||||
|
Reference in New Issue
Block a user