[feature](binlog) Add ingest_binlog/http_get_snapshot limit download speed && Add async ingest_binlog (#26323)

This commit is contained in:
Jack Drogon
2023-11-06 11:14:44 +08:00
committed by GitHub
parent f831774121
commit 2cc68381ec
24 changed files with 709 additions and 332 deletions

View File

@ -124,7 +124,8 @@ std::string get_content_type(const std::string& file_name) {
return "";
}
void do_file_response(const std::string& file_path, HttpRequest* req) {
void do_file_response(const std::string& file_path, HttpRequest* req,
bufferevent_rate_limit_group* rate_limit_group) {
if (file_path.find("..") != std::string::npos) {
LOG(WARNING) << "Not allowed to read relative path: " << file_path;
HttpChannel::send_error(req, HttpStatus::FORBIDDEN);
@ -165,7 +166,7 @@ void do_file_response(const std::string& file_path, HttpRequest* req) {
return;
}
HttpChannel::send_file(req, fd, 0, file_size);
HttpChannel::send_file(req, fd, 0, file_size, rate_limit_group);
}
void do_dir_response(const std::string& dir_path, HttpRequest* req) {