From 53dfc31cb1cb3a12727f3e7c142086401cff0346 Mon Sep 17 00:00:00 2001 From: Victor <87538976+visill@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:03:20 +0500 Subject: [PATCH] Added the duration of the soft interval in group_checker_run in the config. (#693) * Added the duration of the soft interval in group_checker_run in the config. * ; * , and & * Fix comments, add docs for group_checker_interval * Fix links and formatting in docs --- README.md | 1 + documentation/configuration.md | 7 +++++++ sources/config.c | 1 + sources/config.h | 2 ++ sources/config_reader.c | 9 ++++++++- sources/rules.c | 4 ++-- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d6afc746e..b8a68fa1c 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ Set up your CLion to build project in container, [manual](https://github.com/shu * [cache\_coroutine](documentation/configuration.md#cache_coroutine-integer) * [nodelay](documentation/configuration.md#nodelay-yesno) * [keepalive](documentation/configuration.md#keepalive-integer) +* [group\_checker\_interval](documentation/configuration.md#group_checker_interval-integer) ##### System diff --git a/documentation/configuration.md b/documentation/configuration.md index ce7b3a50a..06dcbeef1 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -768,6 +768,13 @@ Enable verbose mode for a specific route only. `log_debug no` +#### group\_checker\_interval *integer* + +Soft interval between group checks (in ms) +7000 by default + +`group_checker_interval 7000` + #### example (remote) ``` diff --git a/sources/config.c b/sources/config.c index 22995ab62..8f28262f2 100644 --- a/sources/config.c +++ b/sources/config.c @@ -56,6 +56,7 @@ void od_config_init(od_config_t *config) config->cache_msg_gc_size = 0; config->coroutine_stack_size = 4; config->hba_file = NULL; + config->group_checker_interval = 7000; // 7 seconds od_list_init(&config->listen); } diff --git a/sources/config.h b/sources/config.h index f8dadbbb8..d8a15cbd7 100644 --- a/sources/config.h +++ b/sources/config.h @@ -76,6 +76,8 @@ struct od_config { int cache_msg_gc_size; int coroutine_stack_size; char *hba_file; + // Soft interval between group checks + int group_checker_interval; od_list_t listen; }; diff --git a/sources/config_reader.c b/sources/config_reader.c index c201084f7..0ba688a0d 100644 --- a/sources/config_reader.c +++ b/sources/config_reader.c @@ -150,6 +150,7 @@ typedef enum { OD_LGROUP_QUERY, OD_LGROUP_QUERY_USER, OD_LGROUP_QUERY_DB, + OD_LGROUP_CHECKER_INTERVAL, } od_lexeme_t; static od_keyword_t od_config_keywords[] = { @@ -277,7 +278,7 @@ static od_keyword_t od_config_keywords[] = { od_keyword("group_query", OD_LGROUP_QUERY), od_keyword("group_query_user", OD_LGROUP_QUERY_USER), od_keyword("group_query_db", OD_LGROUP_QUERY_DB), - + od_keyword("group_checker_interval", OD_LGROUP_CHECKER_INTERVAL), /* auth */ od_keyword("authentication", OD_LAUTHENTICATION), od_keyword("auth_common_name", OD_LAUTH_COMMON_NAME), @@ -2787,6 +2788,12 @@ static int od_config_reader_parse(od_config_reader_t *reader, goto error; continue; } + case OD_LGROUP_CHECKER_INTERVAL: + rc = od_config_reader_number( + reader, &config->group_checker_interval); + if (rc == -1) + goto error; + continue; default: od_config_reader_error(reader, &token, "unexpected parameter"); diff --git a/sources/rules.c b/sources/rules.c index 05ea6b9d5..cfad5d7f9 100644 --- a/sources/rules.c +++ b/sources/rules.c @@ -422,8 +422,8 @@ void od_rules_group_checker_run(void *arg) return; } - /* 7 second soft interval */ - machine_sleep(7000); + /* soft interval between checks */ + machine_sleep(instance->config.group_checker_interval); } }