Skip to content

Commit

Permalink
Optimized code logic (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixficsol authored Jul 29, 2023
1 parent 10320b6 commit 2511dda
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/pika_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1536,11 +1536,8 @@ void PikaServer::AutoResumeDB() {
uint64_t free_size = disk_info.f_bsize * disk_info.f_bfree;
uint64_t total_size = disk_info.f_bsize * disk_info.f_blocks;
double disk_use_ratio = 1.0 - static_cast<double>(free_size) / static_cast<double>(total_size);
if (disk_use_ratio > min_check_resume_ratio) {
if (disk_use_ratio > min_check_resume_ratio && free_size > least_free_size) {
gettimeofday(&last_check_resume_time_, nullptr);
if (disk_use_ratio < min_check_resume_ratio || free_size < least_free_size) {
return;
}

std::map<std::string, uint64_t> background_errors;
std::shared_lock db_rwl(g_pika_server->dbs_rw_);
Expand Down

0 comments on commit 2511dda

Please sign in to comment.