From e9223aaed605fb40d945ca079ba6a22cf381974a Mon Sep 17 00:00:00 2001 From: Ned Wright Date: Tue, 17 Sep 2024 11:03:29 +0000 Subject: [PATCH] code sync --- .../nginx/ngx_module/ngx_http_cp_attachment_module.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/attachments/nginx/ngx_module/ngx_http_cp_attachment_module.c b/attachments/nginx/ngx_module/ngx_http_cp_attachment_module.c index 997597c..7fc2083 100644 --- a/attachments/nginx/ngx_module/ngx_http_cp_attachment_module.c +++ b/attachments/nginx/ngx_module/ngx_http_cp_attachment_module.c @@ -424,6 +424,14 @@ ngx_cp_attachment_init_worker(ngx_cycle_t *cycle) core_main_conf = (ngx_core_conf_t *)ngx_get_conf(cycle->conf_ctx, ngx_core_module); workers_amount_to_send = core_main_conf->worker_processes; } + if (!workers_amount_to_send) { + write_dbg(DBG_LEVEL_DEBUG, "No specific worker count configured. Defaulting to auto-detect based on CPU cores."); + workers_amount_to_send = ngx_ncpu; + } + if (!workers_amount_to_send) { + write_dbg(DBG_LEVEL_DEBUG, "Auto-detection of CPU cores failed. Defaulting to a single worker process."); + workers_amount_to_send = 1; + } // Worker number 0 will always exist. // Therefore the single instance of the timer will be created and destroyed by it. if (ngx_worker == 0) {