Module: kamailio Branch: master Commit: 1fcf99817580379d3e7550d1d874050a3e0315bc URL: https://github.com/kamailio/kamailio/commit/1fcf99817580379d3e7550d1d874050a3e0315bc
Author: Xenofon Karamanos <[email protected]> Committer: Henning Westerholt <[email protected]> Date: 2024-02-02T13:16:08Z file_out: make worker sleep period configurable, to allow to adapt performance parameters --- Modified: src/modules/file_out/doc/file_out_admin.xml Modified: src/modules/file_out/file_out.c --- Diff: https://github.com/kamailio/kamailio/commit/1fcf99817580379d3e7550d1d874050a3e0315bc.diff Patch: https://github.com/kamailio/kamailio/commit/1fcf99817580379d3e7550d1d874050a3e0315bc.patch --- diff --git a/src/modules/file_out/doc/file_out_admin.xml b/src/modules/file_out/doc/file_out_admin.xml index 3054af61672..bcb3f5d14e9 100644 --- a/src/modules/file_out/doc/file_out_admin.xml +++ b/src/modules/file_out/doc/file_out_admin.xml @@ -135,6 +135,25 @@ modparam("file_out", "extension", ".txt") <programlisting format="linespecific"> ... modparam("file_out", "interval_seconds", "300") +... + </programlisting> + </example> + + <title> + <varname>worker_usleep</varname> (int)</title> + <para> + The time in microseconds which worker will sleep for until next iteration. + </para> + <para> + <emphasis> + Default value is <quote>10000</quote> (10 ms). + </emphasis> + </para> + <example> + <title>Set <varname>worker_usleep</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("file_out", "worker_usleep", "1000") ... </programlisting> </example> diff --git a/src/modules/file_out/file_out.c b/src/modules/file_out/file_out.c index 1b9bfba7bb0..dada154eb12 100644 --- a/src/modules/file_out/file_out.c +++ b/src/modules/file_out/file_out.c @@ -61,6 +61,7 @@ char *fo_base_folder = "/var/log/kamailio/file_out/"; char *fo_base_filename[FO_MAX_FILES] = {""}; char *fo_extension = ".out"; int fo_interval_seconds = 10 * 60; +int fo_worker_usleep = 10000; /* Shared variables */ fo_queue_t *fo_queue = NULL; @@ -78,7 +79,8 @@ static param_export_t params[] = { {"base_folder", PARAM_STRING, &fo_base_folder}, {"base_filename", PARAM_STRING | PARAM_USE_FUNC, &fo_add_filename}, {"interval_seconds", PARAM_INT, &fo_interval_seconds}, - {"extension", PARAM_STRING, &fo_extension}, {0, 0, 0}}; + {"extension", PARAM_STRING, &fo_extension}, + {"worker_usleep", PARAM_INT, &fo_worker_usleep}, {0, 0, 0}}; struct module_exports exports = { "file_out", /* module name */ @@ -139,7 +141,7 @@ static int child_init(int rank) return 0; } - pid = fork_process(PROC_NOCHLDINIT, "log_writ", 1); + pid = fork_process(PROC_NOCHLDINIT, "fo_writer", 1); if(pid < 0) { LM_ERR("fork failed\n"); return -1; /* error */ @@ -159,7 +161,7 @@ static int child_init(int rank) /* update the local config framework structures */ cfg_update(); - usleep(10000); + usleep(fo_worker_usleep); fo_log_writer_process(rank); } // return 0; _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to [email protected]
