diff options
author | Zhidao HONG <z.hong@f5.com> | 2024-03-06 16:09:32 +0800 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2024-03-15 15:11:30 +0000 |
commit | 6359c74da1f53dc533ee26acc28972ed9816c9a6 (patch) | |
tree | c4718bb22610f3f6ee43dbe992bb28554fd078a7 | |
parent | 97ff09903ba3feb3248932bcfae6ae983ad0484c (diff) | |
download | unit-6359c74da1f53dc533ee26acc28972ed9816c9a6.tar.gz unit-6359c74da1f53dc533ee26acc28972ed9816c9a6.tar.bz2 |
Var: Fix cacheable issue for njs variable access
The variables accessed with JS template literal should not be cacheable.
Since it is parsed by njs engine, Unit can't create indexes on these
variables for caching purpose. For example:
{
"format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`"
}
The variables like the above are not cacheable.
Closes: https://github.com/nginx/unit/issues/1169
-rw-r--r-- | src/nxt_var.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nxt_var.c b/src/nxt_var.c index 2600371b..57110f66 100644 --- a/src/nxt_var.c +++ b/src/nxt_var.c @@ -147,7 +147,7 @@ nxt_var_ref_get(nxt_tstr_state_t *state, nxt_str_t *name, nxt_mp_t *mp) if (decl != NULL) { ref->handler = decl->handler; - ref->cacheable = decl->cacheable; + ref->cacheable = (mp == state->pool) ? decl->cacheable : 0; goto done; } |