Add test_flood_wait option.
GitOrigin-RevId: 46cdd7db52a54f47380ae21a9457aad6e95dcc61
This commit is contained in:
parent
78601ac8b4
commit
dca95edf27
@ -6964,6 +6964,11 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (set_boolean_option("test_flood_wait")) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
case 'x': {
|
||||
if (request.name_.size() > 255) {
|
||||
|
@ -42,7 +42,13 @@ void NetQueryDispatcher::complete_net_query(NetQueryPtr net_query) {
|
||||
void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
|
||||
net_query->debug("dispatch");
|
||||
if (stop_flag_.load(std::memory_order_relaxed)) {
|
||||
net_query->set_error(Status::Error(500, "Request aborted"));
|
||||
if (net_query->id() != 0) {
|
||||
net_query->set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
return complete_net_query(std::move(net_query));
|
||||
}
|
||||
if (net_query->id() != 0 && G()->shared_config().get_option_boolean("test_flood_wait")) {
|
||||
net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10"));
|
||||
return complete_net_query(std::move(net_query));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user