refactor: 修改 for 循环条件,减少循环次数

This commit is contained in:
bitmin 2022-11-24 14:21:13 +08:00
parent 57d2843f90
commit 026aef16bd

View File

@ -506,13 +506,9 @@ public class StpLogic {
}
}
List<TokenSign> list = session.tokenSignListCopyByDevice(device);
// 遍历操作
for (int i = 0; i < list.size(); i++) {
// 只操作前n条
if(i >= list.size() - maxLoginCount) {
continue;
}
// 清理 token签名token最后活跃时间
// 遍历操作只操作前n条
for (int i = 0; i < list.size() - maxLoginCount; i++) {
// 清理 token签名token最后活跃时间
String tokenValue = list.get(i).getValue();
session.removeTokenSign(tokenValue);
clearLastActivity(tokenValue);