separate time get and reset

This commit is contained in:
andrew (from workstation) 2020-05-20 18:46:11 +02:00
parent ba65f0d2c2
commit 02fd61eb6b
2 changed files with 8 additions and 4 deletions

View File

@ -45,10 +45,12 @@ class FileId {
return id;
}
int64 get_time() {
auto res = time_;
int64 get_time() const {
return time_;
}
void reset_time() {
time_ = INT64_MAX;
return res;
}
int32 get_remote() const {

View File

@ -3486,7 +3486,9 @@ void FileManager::memory_cleanup() {
if (main_node_id != 0) {
auto &node = file_nodes_[main_node_id];
if (node != nullptr && ((int32) i) == node->main_file_id_.fast_get()) {
if (time - node->main_file_id_.get_time() > 60 * 5 /* MAIN FILE TTL */) {
if (time - node->main_file_id_.get_time() > 5 /* MAIN FILE TTL */) {
node->main_file_id_.reset_time();
for (auto &file_id : node->file_ids_) {
/* DESTROY ASSOCIATED QUERIES */
destroy_query(file_id.fast_get());