You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/07/06 00:22:16 UTC

[skywalking-nginx-lua] branch master updated: stop reporting traces after the worker process begins to exit (#105)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-nginx-lua.git


The following commit(s) were added to refs/heads/master by this push:
     new d15c0ce  stop reporting traces after the worker process begins to exit (#105)
d15c0ce is described below

commit d15c0ce8ac10a903efc1379bf19cbe48641f331b
Author: renzheng.wang <wa...@gmail.com>
AuthorDate: Wed Jul 6 08:22:11 2022 +0800

    stop reporting traces after the worker process begins to exit (#105)
---
 lib/skywalking/client.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/skywalking/client.lua b/lib/skywalking/client.lua
index 2dfd70a..881160d 100644
--- a/lib/skywalking/client.lua
+++ b/lib/skywalking/client.lua
@@ -204,9 +204,14 @@ function Client:reportTraces(metadata_buffer, backend_http_uri)
         end
 
         segmentTransform = segmentTransform .. segment
-        segment = queue:rpop(Const.segment_queue)
         count = count + 1
 
+        if ngx.worker.exiting() then
+            break
+        end
+
+        segment = queue:rpop(Const.segment_queue)
+
         if count >= SEGMENT_BATCH_COUNT then
             if sendSegments('[' .. segmentTransform .. ']', backend_http_uri) then
                 totalCount = totalCount + count