dont update time on filemanager memory cleanup

This commit is contained in:
andrew (from workstation) 2020-05-20 18:29:35 +02:00
parent 46ddfccaf1
commit fb12e67583
2 changed files with 9 additions and 5 deletions

View File

@ -35,6 +35,10 @@ class FileId {
return id > 0; return id > 0;
} }
int32 fast_get() const {
return id;
}
int32 get() { int32 get() {
time = std::time(nullptr); time = std::time(nullptr);
return id; return id;

View File

@ -3489,7 +3489,7 @@ void FileManager::memory_cleanup() {
if (time - node->main_file_id_.get_time() > 60 * 5 /* MAIN FILE TTL */) { if (time - node->main_file_id_.get_time() > 60 * 5 /* MAIN FILE TTL */) {
for (auto &file_id : node->file_ids_) { for (auto &file_id : node->file_ids_) {
/* DESTROY ASSOCIATED QUERIES */ /* DESTROY ASSOCIATED QUERIES */
destroy_query(file_id.get()); destroy_query(file_id.fast_get());
/* DESTROY ASSOCIATED NODE */ /* DESTROY ASSOCIATED NODE */
auto &ref_node_id = file_id_info_[file_id.get()].node_id_; auto &ref_node_id = file_id_info_[file_id.get()].node_id_;
@ -3504,7 +3504,7 @@ void FileManager::memory_cleanup() {
} }
/* DESTROY ASSOCIATED FILE */ /* DESTROY ASSOCIATED FILE */
file_id_info_[file_id.get()] = FileIdInfo(); file_id_info_[file_id.fast_get()] = FileIdInfo();
empty_file_ids_.push_back(file_id.get()); empty_file_ids_.push_back(file_id.get());
} }
@ -3548,7 +3548,7 @@ void FileManager::memory_cleanup() {
auto &node = file_nodes_[i]; auto &node = file_nodes_[i];
if (node != nullptr) { if (node != nullptr) {
auto invalid = file_id_info_[node->main_file_id_.get()].node_id_ != ((int32) i); auto invalid = file_id_info_[node->main_file_id_.fast_get()].node_id_ != ((int32) i);
if (!invalid) { if (!invalid) {
for (auto &file : node->file_ids_) { for (auto &file : node->file_ids_) {
@ -3561,9 +3561,9 @@ void FileManager::memory_cleanup() {
if (invalid) { if (invalid) {
for (auto &file : node->file_ids_) { for (auto &file : node->file_ids_) {
destroy_query(file.get()); destroy_query(file.fast_get());
context_->destroy_file_source(file); context_->destroy_file_source(file);
file_id_info_[file.get()] = FileIdInfo(); file_id_info_[file.fast_get()] = FileIdInfo();
empty_file_ids_.push_back(file.get()); empty_file_ids_.push_back(file.get());
} }