aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_http_js_module.c
diff options
context:
space:
mode:
authorDmitry Volyntsev <xeioex@nginx.com>2025-05-14 18:00:23 -0700
committerDmitry Volyntsev <xeioexception@gmail.com>2025-05-22 16:54:29 -0700
commitc7128880915d7201db1d2bc05baa5ba5e1287ce6 (patch)
treea4b05226f6d0861eabe38f55d79869cb1fb82b26 /nginx/ngx_http_js_module.c
parenta340ad8f7d9bd5ee1bfb7e6d76f56e845fe002f3 (diff)
downloadnjs-c7128880915d7201db1d2bc05baa5ba5e1287ce6.tar.gz
njs-c7128880915d7201db1d2bc05baa5ba5e1287ce6.zip
Modules: separating different init worker components.
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r--nginx/ngx_http_js_module.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c
index 40bb83a5..3b493bd1 100644
--- a/nginx/ngx_http_js_module.c
+++ b/nginx/ngx_http_js_module.c
@@ -7684,21 +7684,12 @@ ngx_http_js_init(ngx_conf_t *cf)
static ngx_int_t
-ngx_http_js_init_worker(ngx_cycle_t *cycle)
+ngx_http_js_init_worker_periodics(ngx_js_main_conf_t *jmcf)
{
ngx_uint_t i;
ngx_js_periodic_t *periodics;
- ngx_js_main_conf_t *jmcf;
-
- if ((ngx_process != NGX_PROCESS_WORKER)
- && ngx_process != NGX_PROCESS_SINGLE)
- {
- return NGX_OK;
- }
-
- jmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_js_module);
- if (jmcf == NULL || jmcf->periodics == NULL) {
+ if (jmcf->periodics == NULL) {
return NGX_OK;
}
@@ -7726,6 +7717,31 @@ ngx_http_js_init_worker(ngx_cycle_t *cycle)
}
+static ngx_int_t
+ngx_http_js_init_worker(ngx_cycle_t *cycle)
+{
+ ngx_js_main_conf_t *jmcf;
+
+ if ((ngx_process != NGX_PROCESS_WORKER)
+ && ngx_process != NGX_PROCESS_SINGLE)
+ {
+ return NGX_OK;
+ }
+
+ jmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_js_module);
+
+ if (jmcf == NULL) {
+ return NGX_OK;
+ }
+
+ if (ngx_http_js_init_worker_periodics(jmcf) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+}
+
+
static char *
ngx_http_js_periodic(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{