Skip to content

Commit

Permalink
Added the duration of the soft interval in group_checker_run in the c…
Browse files Browse the repository at this point in the history
…onfig. (#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
  • Loading branch information
visill authored Sep 30, 2024
1 parent a0f5ec5 commit 53dfc31
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions documentation/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

```
Expand Down
1 change: 1 addition & 0 deletions sources/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions sources/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
9 changes: 8 additions & 1 deletion sources/config_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions sources/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 53dfc31

Please sign in to comment.