tzssangglass commented on a change in pull request #4965:
URL: https://github.com/apache/apisix/pull/4965#discussion_r701547185



##########
File path: apisix/plugins/proxy-mirror.lua
##########
@@ -15,7 +15,7 @@
 -- limitations under the License.
 --
 local core          = require("apisix.core")
-
+local math = math

Review comment:
       ```suggestion
   local math_random = math.random
   ```

##########
File path: apisix/plugins/proxy-mirror.lua
##########
@@ -53,7 +59,17 @@ function _M.rewrite(conf, ctx)
     core.log.info("proxy mirror plugin rewrite phase, conf: ", 
core.json.delay_encode(conf))
 
     ctx.var.upstream_host = ctx.var.host
-    ctx.var.upstream_mirror_host = conf.host
+
+    if not conf.percentage or conf.percentage == 1 then
+        ctx.var.upstream_mirror_host = conf.host
+    else
+        local val = math.random()

Review comment:
       ```suggestion
           local val = math_random()
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to