You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/03 13:25:42 UTC

[GitHub] [apisix] gy09535 opened a new pull request #2953: fix: change string concat

gy09535 opened a new pull request #2953:
URL: https://github.com/apache/apisix/pull/2953


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   fix:https://github.com/apache/apisix/issues/2930
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] gy09535 commented on a change in pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
gy09535 commented on a change in pull request #2953:
URL: https://github.com/apache/apisix/pull/2953#discussion_r535237632



##########
File path: apisix/plugins/sls-logger.lua
##########
@@ -126,17 +127,13 @@ local function remove_stale_objects(premature)
 end
 
 local function combine_syslog(entries)
-    local data
+    local data = {}
     for _, entry in ipairs(entries) do
-        if not data then
-           data = entry.data
-        end
-
-        data = data .. entry.data
+        table.insert(data, entry.data)
         core.log.info("buffered logs:", entry.data)
     end
 
-    return data
+    return table.concat(data)
 end

Review comment:
       fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tokers merged pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
tokers merged pull request #2953:
URL: https://github.com/apache/apisix/pull/2953


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on a change in pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #2953:
URL: https://github.com/apache/apisix/pull/2953#discussion_r535310978



##########
File path: apisix/plugins/sls-logger.lua
##########
@@ -126,26 +127,23 @@ local function remove_stale_objects(premature)
 end
 
 local function combine_syslog(entries)
-    local data
+    local data = {}

Review comment:
       how about the name `items`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #2953:
URL: https://github.com/apache/apisix/pull/2953#discussion_r535229644



##########
File path: apisix/plugins/sls-logger.lua
##########
@@ -126,17 +127,13 @@ local function remove_stale_objects(premature)
 end
 
 local function combine_syslog(entries)
-    local data
+    local data = {}
     for _, entry in ipairs(entries) do
-        if not data then
-           data = entry.data
-        end
-
-        data = data .. entry.data
+        table.insert(data, entry.data)
         core.log.info("buffered logs:", entry.data)
     end
 
-    return data
+    return table.concat(data)
 end

Review comment:
       Better to put `_M.combine_syslog = combine_syslog` here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] gy09535 commented on a change in pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
gy09535 commented on a change in pull request #2953:
URL: https://github.com/apache/apisix/pull/2953#discussion_r535776872



##########
File path: apisix/plugins/sls-logger.lua
##########
@@ -126,26 +127,23 @@ local function remove_stale_objects(premature)
 end
 
 local function combine_syslog(entries)
-    local data
+    local data = {}

Review comment:
       Good, I am tangled what name for the local var.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] gy09535 commented on a change in pull request #2953: fix: change string concat

Posted by GitBox <gi...@apache.org>.
gy09535 commented on a change in pull request #2953:
URL: https://github.com/apache/apisix/pull/2953#discussion_r535778902



##########
File path: apisix/plugins/sls-logger.lua
##########
@@ -126,26 +127,23 @@ local function remove_stale_objects(premature)
 end
 
 local function combine_syslog(entries)
-    local data
+    local data = {}

Review comment:
       fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org