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

Small changes on refactor APIKeyLastUseCache get #4216

Merged
merged 7 commits into from
Feb 24, 2023
Merged

Conversation

khanhtc1202
Copy link
Member

What this PR does / why we need it:

Which issue(s) this PR fixes:

Follow #4201

Does this PR introduce a user-facing change?:

NONE

Comment on lines 1532 to 1533
if cachedLastUse, err := a.apiKeyLastUsedStore.Get(apiKeys[i].Id); err == nil {
lastUsedAt, err = strconv.ParseInt(string(cachedLastUse.([]byte)), 10, 64)
Copy link
Member

Choose a reason for hiding this comment

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

[nits] This is also the same.

Suggested change
if cachedLastUse, err := a.apiKeyLastUsedStore.Get(apiKeys[i].Id); err == nil {
lastUsedAt, err = strconv.ParseInt(string(cachedLastUse.([]byte)), 10, 64)
if cachedLastUse, err := a.apiKeyLastUsedStore.Get(apiKeys[i].Id); err == nil {
s := string(cachedLastUse.([]byte)
lastUsedAt, err = strconv.ParseInt(s, 10, 64)

if cachedLastUse, err := a.apiKeyLastUsedStore.Get(apiKeys[i].Id); err == nil {
lastUsedAt, err = strconv.ParseInt(string(cachedLastUse.([]byte)), 10, 64)
if err != nil {
a.logger.Error("failed to get last used time from cache", zap.Error(err))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
a.logger.Error("failed to get last used time from cache", zap.Error(err))
a.logger.Error("failed to parse last used time from cache", zap.Error(err))

lastUsedAt, err = strconv.ParseInt(string(cachedLastUse.([]byte)), 10, 64)
if err != nil {
a.logger.Error("failed to get last used time from cache", zap.Error(err))
}
Copy link
Member

Choose a reason for hiding this comment

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

We should check the 1532 line's error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure do, I updated this part 🙆‍♀️

Copy link
Member

@knanao knanao left a comment

Choose a reason for hiding this comment

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

Here you go!

@khanhtc1202 khanhtc1202 merged commit f804bfb into master Feb 24, 2023
@khanhtc1202 khanhtc1202 deleted the refactor branch February 24, 2023 02:00
@github-actions github-actions bot mentioned this pull request Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants