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

Ensure TTL caches evict expired item #416

Merged
merged 4 commits into from
Nov 29, 2023

Conversation

haoming29
Copy link
Contributor

@haoming29 haoming29 commented Nov 28, 2023

Closes #330

The added unit tests to director's serverAds cache and namespaceKeys cache suggest that expired cache item won't be evicted with existing code, so this PR added cache.Start() to all TTL cache instances to ensure they work as expected.

The part I'm not sure about is whether we should call cache.Stop() at the shutdown of the program. I called Stop() for now but I don't know if this is redundant or not.

@haoming29 haoming29 marked this pull request as ready for review November 28, 2023 20:24
@haoming29 haoming29 added this to the v7.4.0 milestone Nov 28, 2023
@haoming29 haoming29 added bug Something isn't working test Improvements to the test suite labels Nov 28, 2023
@haoming29 haoming29 modified the milestones: v7.4.0, v7.3.0 Nov 28, 2023
cmd/cache_serve.go Show resolved Hide resolved
Copy link
Member

@jhiemstrawisc jhiemstrawisc left a comment

Choose a reason for hiding this comment

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

LGTM!

@jhiemstrawisc jhiemstrawisc merged commit 146e8e1 into PelicanPlatform:main Nov 29, 2023
6 checks passed
@haoming29 haoming29 deleted the test-cache-eviction branch December 6, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test Improvements to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit tests to ttlcache to make sure cache eviction works
2 participants