]> git.kaiwu.me - njs.git/commitdiff
Modules: removed extra VMs creation when it is not needed.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 12 Oct 2024 00:23:42 +0000 (17:23 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 14 Oct 2024 23:51:54 +0000 (16:51 -0700)
Previously, a new VM instance was created for every location. This is
not needed and consumes a lot of memory for large configurations.
Instead, if no new js_import is introduced on the location level server
level VM should be used.

The issue was introduced in 9b674412 (0.8.6).

This fixes #795 issue on Github.

nginx/ngx_js.c

index 98e48dc2ca159aea38218e62d01eb5fb587196c6..152045f037c1e1a3b699d35bfe3fa59b85c8efca 100644 (file)
@@ -3360,7 +3360,7 @@ ngx_js_merge_vm(ngx_conf_t *cf, ngx_js_loc_conf_t *conf,
     ngx_js_named_path_t  *import, *pi, *pij, *preload;
 
     if (conf->imports == NGX_CONF_UNSET_PTR
-        && conf->type == NGX_CONF_UNSET_UINT
+        && conf->type == prev->type
         && conf->paths == NGX_CONF_UNSET_PTR
         && conf->preload_objects == NGX_CONF_UNSET_PTR)
     {