mirror of
https://github.com/openappsec/attachment.git
synced 2025-12-31 13:49:09 +03:00
get worker workers inside the init_attachmetn
This commit is contained in:
@@ -5,7 +5,6 @@ local nano = {}
|
|||||||
|
|
||||||
nano.session_counter = 0
|
nano.session_counter = 0
|
||||||
nano.attachments = {}
|
nano.attachments = {}
|
||||||
nano.num_workers = ngx.worker.count() or 1
|
|
||||||
nano.allocated_strings = {}
|
nano.allocated_strings = {}
|
||||||
nano.allocate_headers = {}
|
nano.allocate_headers = {}
|
||||||
nano.allocated_metadata = {}
|
nano.allocated_metadata = {}
|
||||||
@@ -178,11 +177,12 @@ end
|
|||||||
|
|
||||||
function nano.init_attachment()
|
function nano.init_attachment()
|
||||||
local worker_id = ngx.worker.id()
|
local worker_id = ngx.worker.id()
|
||||||
|
local num_workers = ngx.worker.count() or 1 -- Get count dynamically
|
||||||
local attachment, err
|
local attachment, err
|
||||||
local retries = 3
|
local retries = 3
|
||||||
|
|
||||||
for attempt = 1, retries do
|
for attempt = 1, retries do
|
||||||
attachment, err = nano_attachment.init_nano_attachment(worker_id, nano.num_workers)
|
attachment, err = nano_attachment.init_nano_attachment(worker_id, num_workers)
|
||||||
if attachment then
|
if attachment then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user