Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small improvements #957

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int convert_bytes_num_to_string(long long bytes, char *res, int res_size) {
}

int parse_time_limit(const char *s) {
int x;
int x = 0;
char c = 0;
if (sscanf(s, "%d%c", &x, &c) < 1) {
kprintf ("Parsing time limit for option fail: %s\n", s);
Expand Down
2 changes: 1 addition & 1 deletion docs/kphp-server/execution-options/server-cmd-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ A unique name for the KPHP server, required if several KPHP servers are launched

<aside>--time-limit {limit} / -t {limit}</aside>

A time limit in seconds for script processing, default **30** for server mode and **infinity** for CLI mode. To override, pass a whole number. The maximum is 7 minutes (if passed a greater value, it would be ceiled).
A time limit in seconds for script processing, default **30s** for server mode and **infinity** for CLI mode. To override, pass a whole number. (You can use the s/m/h/d prefix to set the limit in seconds/minutes/hours/days)

<aside>--worker-queries-to-reload {n}</aside>

Expand Down
8 changes: 6 additions & 2 deletions server/php-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,11 @@ int main_args_handler(int i, const char *long_option) {
}
case 'm': {
max_memory = parse_memory_limit_default(optarg, 'm');
assert((1 << 20) <= max_memory && max_memory <= (2047LL << 20));
const long long min_size = 1 << 20;
if (max_memory <= min_size) {
kprintf("--%s option: cannot be less than 1 megabyte\n", long_option);
return -1;
}
return 0;
}
case 'f': {
Expand Down Expand Up @@ -1873,7 +1877,7 @@ int main_args_handler(int i, const char *long_option) {
return vk::singleton<ServerConfig>::get().init_from_config(optarg);
}
case 't': {
script_timeout = static_cast<int>(normalize_script_timeout(atoi(optarg)));
script_timeout = static_cast<int>(normalize_script_timeout(parse_time_limit(optarg)));
return 0;
}
case 'o': {
Expand Down