add getter functions for timeout

This commit is contained in:
wiaamm
2025-12-13 12:09:37 +02:00
parent 0cb1cf0a67
commit 18a7fb587d
5 changed files with 99 additions and 3 deletions

View File

@@ -489,4 +489,30 @@ function nano.end_inspection(session_id, session_data, chunk_type)
return verdict, response
end
function nano.get_request_processing_timeout_sec()
local worker_id = ngx.worker.id()
local attachment = nano.attachments[worker_id]
if not attachment then
kong.log.warn("Attachment not available for worker ", worker_id, " - using default timeout")
return 3
end
local timeout_msec = nano_attachment.get_request_processing_timeout_msec(attachment)
return timeout_msec / 1000.0
end
function nano.get_response_processing_timeout_sec()
local worker_id = ngx.worker.id()
local attachment = nano.attachments[worker_id]
if not attachment then
kong.log.warn("Attachment not available for worker ", worker_id, " - using default timeout")
return 3
end
local timeout_msec = nano_attachment.get_response_processing_timeout_msec(attachment)
return timeout_msec / 1000.0
end
return nano