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

Use Guava cache for ExpirationSet to simplify and optimise implementation #168

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Nov 4, 2022

PR Description

Simplify and optimise ExpirationSet by using guava cache. Fixes a bug where the newest item was removed when the set was full rather than the oldest.
Optimise stats collection in KBucket to avoid creating new lists of all nodes.

Fixed Issue(s)

Consensys/teku#6371

…tion.

Optimise stats collection in KBucket to avoid creating new lists of all nodes.
}
this.size = size;
public ExpirationSet(final long expirationDelayMillis, final Clock clock, final long maxSize) {
checkArgument(maxSize > 0, "Minimal size is 1");
Copy link
Contributor

Choose a reason for hiding this comment

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

minimum size?

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

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

LGTM just a nit

@ajsutton ajsutton merged commit 9ef672b into Consensys:master Nov 4, 2022
@ajsutton ajsutton deleted the simplify-expiration branch November 4, 2022 01:47
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