Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1082 修复在更新token无操作有效期时的时间判断问题 #1104

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

linxiaowu1992
Copy link

@linxiaowu1992 linxiaowu1992 commented Sep 13, 2023

变更点(Changes)

  • 修复在更新token无操作有效期时的时间判断问题

相关issues (Which issues this PR fixes)

备注(Special notes)

BkToken表中inactive_expire_time字段,在更新时,是基于当前时间+ 无操作失效期,即inactive_expire_time = now_time + BK_INACTIVE_COOKIE_AGE。
在原代码中,更新inactive_expire_time前的判断(该判断是为了避免频繁更新inactive_expire_time带来的性能问题):
if now_time > inactive_expire_time + settings.BK_INACTIVE_UPDATE_INTERVEL:
存在问题,相当于是:if now_time > (now_time1 + BK_INACTIVE_COOKIE_AGE) + settings.BK_INACTIVE_UPDATE_INTERVEL:
判断结果基本不可能为true,不会进入到更新inactive_expire_time代码。
因此,需要修复为:
if now_time + BK_INACTIVE_COOKIE_AGE > inactive_expire_time + settings.BK_INACTIVE_UPDATE_INTERVEL

Copy link
Collaborator

@wklken wklken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wklken wklken merged commit 8a1b567 into TencentBlueKing:ft_upgrade_py3 Sep 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants