Authored by skinny.wu

redis caps值计算公式 修改

@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.scheduling.annotation.EnableScheduling; 21 import org.springframework.scheduling.annotation.EnableScheduling;
22 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
23 import org.springframework.util.CollectionUtils; 23 import org.springframework.util.CollectionUtils;
24 -  
25 import java.math.BigDecimal; 24 import java.math.BigDecimal;
26 import java.util.ArrayList; 25 import java.util.ArrayList;
27 import java.util.HashMap; 26 import java.util.HashMap;
@@ -53,9 +52,9 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService @@ -53,9 +52,9 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService
53 @Autowired 52 @Autowired
54 private SnsMobileConfig snsMobileConfig; 53 private SnsMobileConfig snsMobileConfig;
55 54
56 - private static Map<String, Long> lastUpTimeMap = new HashMap<>(); 55 + private Map<String, Long> lastUpTimeMap = new HashMap<>();
57 56
58 - private static Map<String, Long> lastRequestCountMap = new HashMap<>(); 57 + private Map<String, Long> lastRequestCountMap = new HashMap<>();
59 58
60 @Override 59 @Override
61 public void redisMonitor() { 60 public void redisMonitor() {
@@ -185,7 +184,7 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService @@ -185,7 +184,7 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService
185 184
186 long lastRequestCount = lastRequestCountMap.get(ipString); 185 long lastRequestCount = lastRequestCountMap.get(ipString);
187 long lastUpTime = lastUpTimeMap.get(ipString); 186 long lastUpTime = lastUpTimeMap.get(ipString);
188 - caps = (requestCount - lastRequestCount) * 1.0 / ((upTime - lastUpTime) * 1000) / redisCount; 187 + caps = (requestCount - lastRequestCount) * 1.0 / (upTime - lastUpTime) / redisCount;
189 } 188 }
190 189
191 //将当前的uptime request数据存到map中 190 //将当前的uptime request数据存到map中