From 4b4acd224a9ff9c2b4704cf0b3d465eee0eb72c2 Mon Sep 17 00:00:00 2001 From: Shiroko Date: Mon, 23 Sep 2024 15:27:57 +0800 Subject: [PATCH] feat(request-debugging): fix a bug when no child is present --- kong/timing/context.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kong/timing/context.lua b/kong/timing/context.lua index 0d3b4f5c88f..f05ed29a051 100644 --- a/kong/timing/context.lua +++ b/kong/timing/context.lua @@ -120,7 +120,9 @@ function _M:to_json() self:set_root_context_prop("dangling", dangling) self:finalize(self.root_context) - self.root_context.total_time_without_upstream = self:get_total_time_without_upstream() + if self.root_context.child ~= nil then + self.root_context.total_time_without_upstream = self:get_total_time_without_upstream() + end return assert(cjson.encode(self.root_context)) end