Skip to content

Commit

Permalink
add InitLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyuecai committed Jun 10, 2024
1 parent e9f11f9 commit 7741a42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pikiwidb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ static int InitLimit() {
rlimit limit;
rlim_t maxfiles = g_config.max_clients;
if (getrlimit(RLIMIT_NOFILE, &limit) == -1) {
WARN("getrlimit error: ", strerror(errno));
WARN("getrlimit error: {}", strerror(errno));
} else if (limit.rlim_cur < maxfiles) {
rlim_t old_limit = limit.rlim_cur;
limit.rlim_cur = maxfiles;
limit.rlim_max = maxfiles;
if (setrlimit(RLIMIT_NOFILE, &limit) != -1) {
WARN( "your 'limit -n ' of ", old_limit, " is not enough for PikiwiDB to start. PikiwiDB have successfully reconfig it to " , limit.rlim_cur);
WARN("your 'limit -n ' of {} is not enough for PikiwiDB to start. PikiwiDB have successfully reconfig it to " , old_limit, limit.rlim_cur);
} else {
ERROR("your 'limit -n ' of " , old_limit, " is not enough for PikiwiDB to start. PikiwiDB can not reconfig it(", strerror(errno), "), do it by yourself");
ERROR("your 'limit -n ' of {} is not enough for PikiwiDB to start. PikiwiDB can not reconfig it({}), do it by yourself", old_limit, strerror(errno));
return -1;
}
}
Expand Down

0 comments on commit 7741a42

Please sign in to comment.