Use different resource limit for upload and download connections.
This commit is contained in:
parent
fac6b73999
commit
ddbca1bb16
@ -24,21 +24,22 @@ FileLoadManager::FileLoadManager(ActorShared<Callback> callback, ActorShared<> p
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileLoadManager::start_up() {
|
void FileLoadManager::start_up() {
|
||||||
if (G()->shared_config().get_option_boolean("is_premium")) {
|
constexpr int64 MAX_UPLOAD_RESOURCE_LIMIT = 4 << 20;
|
||||||
max_resource_limit_ *= 8;
|
upload_resource_manager_ = create_actor<ResourceManager>("UploadResourceManager", MAX_UPLOAD_RESOURCE_LIMIT,
|
||||||
}
|
|
||||||
upload_resource_manager_ = create_actor<ResourceManager>("UploadResourceManager", max_resource_limit_,
|
|
||||||
!G()->parameters().use_file_db /*tdlib_engine*/
|
!G()->parameters().use_file_db /*tdlib_engine*/
|
||||||
? ResourceManager::Mode::Greedy
|
? ResourceManager::Mode::Greedy
|
||||||
: ResourceManager::Mode::Baseline);
|
: ResourceManager::Mode::Baseline);
|
||||||
|
if (G()->shared_config().get_option_boolean("is_premium")) {
|
||||||
|
max_download_resource_limit_ *= 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorOwn<ResourceManager> &FileLoadManager::get_download_resource_manager(bool is_small, DcId dc_id) {
|
ActorOwn<ResourceManager> &FileLoadManager::get_download_resource_manager(bool is_small, DcId dc_id) {
|
||||||
auto &actor = is_small ? download_small_resource_manager_map_[dc_id] : download_resource_manager_map_[dc_id];
|
auto &actor = is_small ? download_small_resource_manager_map_[dc_id] : download_resource_manager_map_[dc_id];
|
||||||
if (actor.empty()) {
|
if (actor.empty()) {
|
||||||
actor = create_actor<ResourceManager>(
|
actor = create_actor<ResourceManager>(
|
||||||
PSLICE() << "DownloadResourceManager " << tag("is_small", is_small) << tag("dc_id", dc_id), max_resource_limit_,
|
PSLICE() << "DownloadResourceManager " << tag("is_small", is_small) << tag("dc_id", dc_id),
|
||||||
ResourceManager::Mode::Baseline);
|
max_download_resource_limit_, ResourceManager::Mode::Baseline);
|
||||||
}
|
}
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
@ -185,7 +186,7 @@ void FileLoadManager::update_downloaded_part(QueryId id, int64 offset, int64 lim
|
|||||||
if (node == nullptr) {
|
if (node == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send_closure(node->loader_, &FileLoaderActor::update_downloaded_part, offset, limit, max_resource_limit_);
|
send_closure(node->loader_, &FileLoaderActor::update_downloaded_part, offset, limit, max_download_resource_limit_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLoadManager::hangup() {
|
void FileLoadManager::hangup() {
|
||||||
|
@ -80,7 +80,7 @@ class FileLoadManager final : public Actor {
|
|||||||
ActorShared<Callback> callback_;
|
ActorShared<Callback> callback_;
|
||||||
ActorShared<> parent_;
|
ActorShared<> parent_;
|
||||||
std::map<QueryId, NodeId> query_id_to_node_id_;
|
std::map<QueryId, NodeId> query_id_to_node_id_;
|
||||||
int64 max_resource_limit_ = 1 << 21;
|
int64 max_download_resource_limit_ = 1 << 21;
|
||||||
bool stop_flag_ = false;
|
bool stop_flag_ = false;
|
||||||
|
|
||||||
void start_up() final;
|
void start_up() final;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user