Skip to content

Commit 8e6c9a3

Browse files
committed
change: raised the "lua_code_cache is off" warning to an alert.
1 parent c4657a3 commit 8e6c9a3

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

src/ngx_http_lua_directive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ ngx_http_lua_code_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
124124
fp = (ngx_flag_t *) (p + cmd->offset);
125125

126126
if (!*fp) {
127-
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
127+
ngx_conf_log_error(NGX_LOG_ALERT, cf, 0,
128128
"lua_code_cache is off; this will hurt "
129129
"performance");
130130
}

t/025-codecache.t

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use t::TestNginxLua;
55

66
repeat_each(2);
77

8-
plan tests => repeat_each() * (blocks() * 2 + 1);
8+
plan tests => repeat_each() * (blocks() * 3 + 1);
99

1010
#$ENV{LUA_PATH} = $ENV{HOME} . '/work/JSON4Lua-0.9.30/json/?.lua';
1111

@@ -45,6 +45,8 @@ GET /main
4545
32
4646
updated
4747
32
48+
--- no_error_log
49+
[alert]
4850

4951

5052

@@ -77,6 +79,8 @@ GET /main
7779
32
7880
updated
7981
32
82+
--- no_error_log
83+
[alert]
8084

8185

8286

@@ -109,6 +113,9 @@ GET /main
109113
32
110114
updated
111115
101
116+
--- error_log eval
117+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
118+
112119

113120

114121

@@ -142,6 +149,9 @@ GET /main
142149
32
143150
updated
144151
101
152+
--- error_log eval
153+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
154+
145155

146156

147157

@@ -176,6 +186,8 @@ GET /main
176186
32
177187
updated
178188
32
189+
--- error_log eval
190+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
179191

180192

181193

@@ -212,6 +224,8 @@ GET /main
212224
32
213225
updated
214226
102
227+
--- error_log eval
228+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
215229

216230

217231

@@ -248,6 +262,8 @@ GET /main
248262
32
249263
updated
250264
102
265+
--- error_log eval
266+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
251267

252268

253269

@@ -285,6 +301,8 @@ GET /main
285301
32
286302
updated
287303
102
304+
--- error_log eval
305+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
288306

289307

290308

@@ -322,6 +340,8 @@ GET /main
322340
32
323341
updated
324342
32
343+
--- no_error_log
344+
[alert]
325345

326346

327347

@@ -355,6 +375,8 @@ GET /main
355375
32
356376
updated
357377
101
378+
--- error_log eval
379+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
358380

359381

360382

@@ -388,6 +410,8 @@ GET /main
388410
32
389411
updated
390412
32
413+
--- no_error_log
414+
[alert]
391415

392416

393417

@@ -412,6 +436,9 @@ ngx.say(table.concat({1,2,3}, ", "))
412436
1, 2, 3
413437
5
414438
1, 2, 3
439+
--- error_log eval
440+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
441+
415442

416443

417444

@@ -435,6 +462,9 @@ ngx.say(table.concat({1,2,3}, ", "))
435462
1, 2, 3
436463
5
437464
1, 2, 3
465+
--- error_log eval
466+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
467+
438468

439469

440470

@@ -469,6 +499,9 @@ ngx.say("OK")
469499
--- response_body
470500
OK
471501
OK
502+
--- error_log eval
503+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
504+
472505

473506

474507

@@ -517,6 +550,9 @@ loading
517550
hello, foo
518551
found
519552
found
553+
--- error_log eval
554+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
555+
520556

521557

522558

@@ -565,6 +601,9 @@ loading
565601
hello, foo
566602
found
567603
found
604+
--- error_log eval
605+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
606+
568607

569608

570609

@@ -587,6 +626,9 @@ found
587626
GET /t
588627
--- response_body
589628
_G.foo: 1
629+
--- error_log eval
630+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
631+
590632

591633

592634

@@ -614,4 +656,7 @@ GET /t
614656
^table: 0x\d*?[1-9a-fA-F]
615657
--- no_error_log
616658
[error]
659+
--- error_log eval
660+
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/
661+
617662

0 commit comments

Comments
 (0)