[ 
https://issues.apache.org/jira/browse/SCB-932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622988#comment-16622988
 ] 

ASF GitHub Bot commented on SCB-932:
------------------------------------

laijianbin closed pull request #918: 【SCB-932】Time jump cause the new request 
injected
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/918
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsController.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsController.java
index 8bc147b8c..8ca7dc648 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsController.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsController.java
@@ -57,7 +57,8 @@ public void setQpsLimit(Integer qpsLimit) {
   public boolean isLimitNewRequest() {
     long newCount = requestCount.incrementAndGet();
     long msNow = System.currentTimeMillis();
-    if (msNow - msCycleBegin > CYCLE_LENGTH) {
+    //时间跳变(9/21->9/20)会导致本不该拒绝的请求被拒绝
+    if (msNow - msCycleBegin > CYCLE_LENGTH || msNow - msCycleBegin < 
-CYCLE_LENGTH) {
       // 新周期
       // 会有多线程竞争,互相覆盖的问题,不过无所谓,不会有什么后果
       lastRequestCount = newCount;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Time jump cause the new request injected
> ----------------------------------------
>
>                 Key: SCB-932
>                 URL: https://issues.apache.org/jira/browse/SCB-932
>             Project: Apache ServiceComb
>          Issue Type: Task
>            Reporter: laijianbin
>            Assignee: laijianbin
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to