You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/05/21 01:48:28 UTC

[apisix] branch master updated: feat(ext-plugin): respawn with delay to avoid flushing error log (#4283)

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

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 916041d  feat(ext-plugin): respawn with delay to avoid flushing error log (#4283)
916041d is described below

commit 916041d9ab21bbe47f7817869e9de77684a38fbd
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Fri May 21 09:48:11 2021 +0800

    feat(ext-plugin): respawn with delay to avoid flushing error log (#4283)
    
    Signed-off-by: spacewander <sp...@gmail.com>
---
 apisix/plugins/ext-plugin/init.lua | 4 +++-
 t/plugin/ext-plugin/sanity.t       | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/apisix/plugins/ext-plugin/init.lua b/apisix/plugins/ext-plugin/init.lua
index f3315b3..190f048 100644
--- a/apisix/plugins/ext-plugin/init.lua
+++ b/apisix/plugins/ext-plugin/init.lua
@@ -612,7 +612,9 @@ local function setup_runner(cmd)
                 core.log.error("post event failure with ", events_list._source, ", error: ", err)
             end
 
-            core.log.warn("respawn runner with cmd: ", core.json.encode(cmd))
+            core.log.warn("respawn runner 3 seconds later with cmd: ", core.json.encode(cmd))
+            core.utils.sleep(3)
+            core.log.warn("respawning new runner...")
             proc = spawn_proc(cmd)
         end
     end)
diff --git a/t/plugin/ext-plugin/sanity.t b/t/plugin/ext-plugin/sanity.t
index deb3f9d..905215e 100644
--- a/t/plugin/ext-plugin/sanity.t
+++ b/t/plugin/ext-plugin/sanity.t
@@ -208,7 +208,7 @@ EXPIRE 3600
     }
 --- error_log
 runner exited with reason: exit, status: 111
-respawn runner with cmd: ["t\/plugin\/ext-plugin\/runner.sh","0.1"]
+respawn runner 3 seconds later with cmd: ["t\/plugin\/ext-plugin\/runner.sh","0.1"]