Skip to content

Commit

Permalink
perf: 优化代码逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron3S committed Oct 16, 2024
1 parent 906081c commit 0316a2b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ public JMSSession(Common.Session session,
this.expireTime = tokenResp.getData().getExpireInfo().getExpireAt();
this.maxIdleTimeDelta = tokenResp.getData().getSetting().getMaxIdleTime();

this.maxSessionEndHours= tokenResp.getData().getSetting().getMaxSessionTime();
this.maxSessionEndHours = tokenResp.getData().getSetting().getMaxSessionTime();
this.maxSessionEndTime = LocalDateTime.now().plusHours(tokenResp.getData().getSetting().getMaxSessionTime());
this.maxSessionEndTime = LocalDateTime.now().plusMinutes(10);
this.dynamicEndTime = this.maxSessionEndTime;

this.canUpload = tokenResp.getData().getPermission().getEnableUpload();
Expand Down Expand Up @@ -213,8 +212,9 @@ private void startWaitIdleTime() {
while (this.isActive()) {
try {
Thread.sleep(5000);

synchronized (this) {
var expireTime = LocalDateTime.ofEpochSecond(this.expireTime, 0, ZoneOffset.UTC);
var expireTime = LocalDateTime.ofEpochSecond(this.expireTime, 0, ZoneOffset.ofHours(8));

if (LocalDateTime.now().isAfter(expireTime)) {
this.close("PermissionsExpiredOn", "permission_expired", expireTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
Expand Down

0 comments on commit 0316a2b

Please sign in to comment.