diff options
Diffstat (limited to 'nginx/ngx_stream_js_module.c')
-rw-r--r-- | nginx/ngx_stream_js_module.c | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/nginx/ngx_stream_js_module.c b/nginx/ngx_stream_js_module.c index 0e022eb0..328ce581 100644 --- a/nginx/ngx_stream_js_module.c +++ b/nginx/ngx_stream_js_module.c @@ -264,6 +264,13 @@ static ngx_command_t ngx_stream_js_commands[] = { offsetof(ngx_stream_js_srv_conf_t, reuse), NULL }, + { ngx_string("js_context_reuse_max_size"), + NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + NGX_STREAM_SRV_CONF_OFFSET, + offsetof(ngx_stream_js_srv_conf_t, reuse_max_size), + NULL }, + { ngx_string("js_import"), NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE13, ngx_js_import, @@ -3192,21 +3199,12 @@ ngx_stream_js_periodic_init(ngx_js_periodic_t *periodic) static ngx_int_t -ngx_stream_js_init_worker(ngx_cycle_t *cycle) +ngx_stream_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; - } + ngx_uint_t i; + ngx_js_periodic_t *periodics; - jmcf = ngx_stream_cycle_get_module_main_conf(cycle, ngx_stream_js_module); - - if (jmcf == NULL || jmcf->periodics == NULL) { + if (jmcf->periodics == NULL) { return NGX_OK; } @@ -3234,6 +3232,35 @@ ngx_stream_js_init_worker(ngx_cycle_t *cycle) } +static ngx_int_t +ngx_stream_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_stream_cycle_get_module_main_conf(cycle, ngx_stream_js_module); + + if (jmcf == NULL) { + return NGX_OK; + } + + if (ngx_stream_js_init_worker_periodics(jmcf) != NGX_OK) { + return NGX_ERROR; + } + + if (ngx_js_dict_init_worker(jmcf) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + static char * ngx_stream_js_periodic(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { |