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

[db] enable overriding of expiryDate on tokens #10102

Merged
merged 1 commit into from
May 18, 2022
Merged

[db] enable overriding of expiryDate on tokens #10102

merged 1 commit into from
May 18, 2022

Conversation

AlexTugarev
Copy link
Member

How to test

  1. sign-in with gitlab.com.
  2. update d_b_token_entry table and set an older date (-1d) for expiryDate.
  3. reload /integrations page.
  4. verify that INFO: Token refreshed and updated. is logged in server.
NONE

@AlexTugarev AlexTugarev requested a review from a team May 18, 2022 13:39
@AlexTugarev AlexTugarev requested a review from jankeromnes May 18, 2022 13:40
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label May 18, 2022
Comment on lines +345 to +350
if (latestTokenEntry) {
if (latestTokenEntry.expiryDate !== latestTokenEntry.token.expiryDate) {
log.info(`Overriding 'expiryDate' of token to get refreshed on demand.`, { identity });
}
return { ...latestTokenEntry.token, expiryDate: latestTokenEntry.expiryDate };
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Would prefer single-level if / early return:

Suggested change
if (latestTokenEntry) {
if (latestTokenEntry.expiryDate !== latestTokenEntry.token.expiryDate) {
log.info(`Overriding 'expiryDate' of token to get refreshed on demand.`, { identity });
}
return { ...latestTokenEntry.token, expiryDate: latestTokenEntry.expiryDate };
}
if (!latestTokenEntry) {
return;
}
if (latestTokenEntry.expiryDate !== latestTokenEntry.token.expiryDate) {
log.info(`Overriding 'expiryDate' of token to get refreshed on demand.`, { identity });
}
return { ...latestTokenEntry.token, expiryDate: latestTokenEntry.expiryDate };

@jankeromnes jankeromnes self-assigned this May 18, 2022
Copy link
Contributor

@jankeromnes jankeromnes left a comment

Choose a reason for hiding this comment

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

Tested and seems to work really well! 👏

@roboquat roboquat merged commit 38b975c into main May 18, 2022
@roboquat roboquat deleted the at/expiryDate branch May 18, 2022 15:12
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/S team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants