theweakgod commented on issue #10757:
URL: https://github.com/apache/apisix/issues/10757#issuecomment-1891730261

   > 我错过了它,`limit_rate = true`然后我添加了它,但它不起作用。
   > 
   > ```
   > diff --git a/apisix/core/ctx.lua b/apisix/core/ctx.lua
   > index dc4c4460..e27978e2 100644
   > --- a/apisix/core/ctx.lua
   > +++ b/apisix/core/ctx.lua
   > @@ -127,7 +127,7 @@ do
   >          upstream_uri               = true,
   >  
   >          upstream_mirror_host       = true,
   > -
   > +        limit_rate                 = true,
   >          upstream_cache_zone        = true,
   >          upstream_cache_zone_info   = true,
   >          upstream_no_cache          = true,
   > diff --git a/apisix/plugins/example-plugin.lua 
b/apisix/plugins/example-plugin.lua
   > index f1d1cc33..4e8a94ee 100644
   > --- a/apisix/plugins/example-plugin.lua
   > +++ b/apisix/plugins/example-plugin.lua
   > @@ -74,14 +74,20 @@ end
   >  
   >  
   >  function _M.rewrite(conf, ctx)
   > -    core.log.warn("plugin rewrite phase, conf: ", core.json.encode(conf))
   > -    core.log.warn("conf_type: ", ctx.conf_type)
   > -    core.log.warn("conf_id: ", ctx.conf_id)
   > -    core.log.warn("conf_version: ", ctx.conf_version)
   > +    ngx.var.limit_rate = "300K"
   > +    ctx.var.limit_rate = "300K"
   > +    core.log.error("22222")
   > +    -- core.log.warn("plugin rewrite phase, conf: ", 
core.json.encode(conf))
   > +    -- core.log.warn("conf_type: ", ctx.conf_type)
   > +    -- core.log.warn("conf_id: ", ctx.conf_id)
   > +    -- core.log.warn("conf_version: ", ctx.conf_version)
   >  end
   >  
   >  
   >  function _M.access(conf, ctx)
   > +    ngx.var.limit_rate = "300K"
   > +    ctx.var.limit_rate = "300K"
   > +    core.log.error("111111")
   >      core.log.warn("plugin access phase, conf: ", core.json.encode(conf))
   >      -- return 200, {message = "hit example plugin"}
   >  
   > diff --git a/conf/config-default.yaml b/conf/config-default.yaml
   > index e7ef02ed..d2dbc926 100644
   > --- a/conf/config-default.yaml
   > +++ b/conf/config-default.yaml
   > @@ -157,7 +157,7 @@ nginx_config:                     # config for render 
the template to generate n
   >                                    # the "user" directive makes sense only 
if the master process runs with super-user privileges.
   >                                    # if you're not root user,the default 
is current user.
   >    error_log: logs/error.log
   > -  error_log_level:  warn          # warn,error
   > +  error_log_level:  info          # warn,error
   >    worker_processes: auto          # if you want use multiple cores in 
container, you can inject the number of cpu as environment variable 
"APISIX_WORKER_PROCESSES"
   >    enable_cpu_affinity: true       # enable cpu affinity, this is just 
work well only on physical machine
   >    worker_rlimit_nofile: 20480     # the number of files a worker process 
can open, should be larger than worker_connections
   > ```
   
![image](https://github.com/apache/apisix/assets/47879179/148ad047-fc01-4b63-829f-31ae41543c0e)
   Is this in the log?
   
   Is this a custom plug?
   


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