Merge pull request #341 from thebitmin/dev

refactor: 修改 for 循环条件,减少循环次数
This commit is contained in:
click33 2022-12-26 23:51:29 +08:00 committed by GitHub
commit 660b932f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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