Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions nginx/ngx_http_js_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -7726,6 +7717,35 @@ 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;
}

if (ngx_js_dict_init_worker(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)
{
Expand Down
8 changes: 6 additions & 2 deletions nginx/ngx_js.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include <njs.h>
#include <njs_rbtree.h>
#include <njs_arr.h>
#include "ngx_js_fetch.h"
#include "ngx_js_shared_dict.h"

#if (NJS_HAVE_QUICKJS)
#include <qjs.h>
Expand Down Expand Up @@ -317,6 +315,9 @@ ngx_int_t ngx_js_exception(njs_vm_t *vm, ngx_str_t *s);
ngx_engine_t *ngx_njs_clone(ngx_js_ctx_t *ctx, ngx_js_loc_conf_t *cf,
void *external);

#define NGX_CHB_CTX_INIT(chain, pool) \
njs_chb_init(chain, pool, (njs_chb_alloc_t) ngx_palloc, NULL)

#if (NJS_HAVE_QUICKJS)

typedef struct ngx_qjs_event_s ngx_qjs_event_t;
Expand Down Expand Up @@ -437,4 +438,7 @@ extern njs_module_t njs_xml_module;
extern njs_module_t njs_zlib_module;


#include "ngx_js_fetch.h"
#include "ngx_js_shared_dict.h"

#endif /* _NGX_JS_H_INCLUDED_ */
Loading