This commit is contained in:
andrew (from workstation) 2020-05-17 13:24:23 +02:00
parent 1cd7f17fc3
commit 878022bc0d

View File

@ -3709,11 +3709,8 @@ void FileManager::memory_cleanup() {
for (unsigned int i = 1; i < file_id_info_.size(); i++) { for (unsigned int i = 1; i < file_id_info_.size(); i++) {
auto main_node_id = file_id_info_[i].node_id_; auto main_node_id = file_id_info_[i].node_id_;
if (main_node_id == 0) { if (main_node_id != 0) {
continue;
}
auto &node = file_nodes_[main_node_id]; auto &node = file_nodes_[main_node_id];
if (node != nullptr && ((int32) i) == node->main_file_id_.get()) { if (node != nullptr && ((int32) i) == node->main_file_id_.get()) {
if (time - file_id_insert_time_[i] > 5 /* MAIN FILE TTL */) { if (time - file_id_insert_time_[i] > 5 /* MAIN FILE TTL */) {
for (auto &file_id : node->file_ids_) { for (auto &file_id : node->file_ids_) {
@ -3725,12 +3722,6 @@ void FileManager::memory_cleanup() {
} }
} }
/* DESTROY ASSOCIATED NODE */
auto file_node_id = file_id_info_[file_id.get()].node_id_;
if (file_node_id != 0) {
file_nodes_[file_node_id] = nullptr;
}
/* DESTROY ASSOCIATED FILE */ /* DESTROY ASSOCIATED FILE */
empty_file_ids_.push_back(file_id.get()); empty_file_ids_.push_back(file_id.get());
file_id_info_[file_id.get()] = FileIdInfo(); file_id_info_[file_id.get()] = FileIdInfo();
@ -3739,7 +3730,7 @@ void FileManager::memory_cleanup() {
/* DESTROY MAIN QUERY */ /* DESTROY MAIN QUERY */
for (auto &query_id : queries_container_.ids()) { for (auto &query_id : queries_container_.ids()) {
auto query = queries_container_.get(query_id); auto query = queries_container_.get(query_id);
if (query != nullptr && ((int32) i) == query->file_id_.get()) { if (query != nullptr && ((int32)i) == query->file_id_.get()) {
on_error(query_id, Status::Error(400, "FILE_DOWNLOAD_RESTART")); on_error(query_id, Status::Error(400, "FILE_DOWNLOAD_RESTART"));
} }
} }
@ -3754,6 +3745,7 @@ void FileManager::memory_cleanup() {
} }
} }
} }
}
LOG(INFO) << empty_file_ids_.size() << " empty ids and " << queries_container_.size() << " running queries"; LOG(INFO) << empty_file_ids_.size() << " empty ids and " << queries_container_.size() << " running queries";
is_closed_ = false; is_closed_ = false;