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

Modify cache purging limit #70

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Modify cache purging limit #70

wants to merge 7 commits into from

Conversation

athum
Copy link

@athum athum commented Aug 28, 2020

When the authenticator's cache is purged, there was a consistent slice bounds out of range [:200] with capacity 181 panic occurring. Purging the entire cache resolves this error.

This is moved over from #68, which is closed.

@athum
Copy link
Author

athum commented Aug 28, 2020

@abbot this PR includes the unit tests. Let me know if you would like any updates! (especially w.r.t. eliminating the count parameter altogeter).

@@ -79,7 +79,8 @@ func (da *DigestAuth) Purge(count int) {
}
cache := digestCache(entries)
sort.Sort(cache)
for _, client := range cache[:count] {
Copy link

Choose a reason for hiding this comment

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

You could use min of count/len if you really want to remove count entries only

Copy link
Author

Choose a reason for hiding this comment

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

@andig updated!

@athum athum requested a review from andig July 11, 2023 19:35
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.

2 participants