Skip to content

Commit

Permalink
Merge pull request #53 from jumpserver/pr@dev@perf_format_code
Browse files Browse the repository at this point in the history
perf: 优化代码逻辑
  • Loading branch information
Aaron3S authored Oct 16, 2024
2 parents 7c7ebeb + 0316a2b commit f797419
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 f797419

Please sign in to comment.