diff --git a/README.markdown b/README.markdown index a90b0859a2..21cafe689d 100644 --- a/README.markdown +++ b/README.markdown @@ -7565,7 +7565,7 @@ ngx.worker.count **syntax:** *count = ngx.worker.count()* -**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.*, init_by_lua** +**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua*, log_by_lua*, ngx.timer.*, init_by_lua*, init_worker_by_lua** Returns the total number of the Nginx worker processes (i.e., the value configured by the [worker_processes](http://nginx.org/en/docs/ngx_core_module.html#worker_processes) diff --git a/t/133-worker-count.t b/t/133-worker-count.t index c97f6b40e5..3e03ecc843 100644 --- a/t/133-worker-count.t +++ b/t/133-worker-count.t @@ -50,3 +50,23 @@ GET /lua workers: 1 --- no_error_log [error] + + + +=== TEST 3: init_worker_by_lua +--- http_config + init_worker_by_lua_block { + init_worker_count = ngx.worker.count() + } +--- config + location /lua { + content_by_lua_block { + ngx.say("workers: ", init_worker_count) + } + } +--- request +GET /lua +--- response_body +workers: 1 +--- no_error_log +[error]