You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/09/17 07:18:02 UTC

[apisix] branch master updated: fix: return ok in kafka-logger (#2222)

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

wenming 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 d050718  fix: return ok in kafka-logger (#2222)
d050718 is described below

commit d05071868d87662e10e392978faad3c0ed08a111
Author: Zhang Qiang <do...@gmail.com>
AuthorDate: Thu Sep 17 15:17:51 2020 +0800

    fix: return ok in kafka-logger (#2222)
---
 apisix/plugins/kafka-logger.lua |  2 ++
 t/plugin/kafka-logger.t         | 10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/apisix/plugins/kafka-logger.lua b/apisix/plugins/kafka-logger.lua
index fc7d90c..6377bf1 100644
--- a/apisix/plugins/kafka-logger.lua
+++ b/apisix/plugins/kafka-logger.lua
@@ -92,6 +92,8 @@ local function send_kafka_data(conf, log_message)
     if not ok then
         return nil, "failed to send data to Kafka topic" .. err
     end
+
+    return true, nil
 end
 
 -- remove stale objects from the memory after timer expires
diff --git a/t/plugin/kafka-logger.t b/t/plugin/kafka-logger.t
index 4dfbe40..a4e0814 100644
--- a/t/plugin/kafka-logger.t
+++ b/t/plugin/kafka-logger.t
@@ -116,7 +116,9 @@ done
                                     "127.0.0.1":9092
                                   },
                                 "kafka_topic" : "test2",
-                                "key" : "key1"
+                                "key" : "key1",
+                                "timeout" : 1,
+                                "batch_max_size": 1
                             }
                         },
                         "upstream": {
@@ -137,7 +139,9 @@ done
                                         "127.0.0.1":9092
                                       },
                                     "kafka_topic" : "test2",
-                                    "key" : "key1"
+                                    "key" : "key1",
+                                    "timeout" : 1,
+                                    "batch_max_size": 1
                                 }
                             },
                             "upstream": {
@@ -175,7 +179,7 @@ GET /hello
 hello world
 --- no_error_log
 [error]
---- wait: 0.2
+--- wait: 2