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

feat(repository): cache engine-relevant methods #270

Merged
merged 9 commits into from
Mar 21, 2024

Conversation

steebchen
Copy link
Member

Description

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

What's Changed

Copy link

vercel bot commented Mar 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hatchet-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2024 5:04pm

Copy link
Contributor

@abelanger5 abelanger5 left a comment

Choose a reason for hiding this comment

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

Code looks good, only additional thing is the failing load test and integration test. We discussed the integration test and making the expiry configurable.

Looks like the load test is failing with:

cli_e2e_test.go:81: found unexpected goroutines:
        [Goroutine 41 in state select, with github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...].func1 on top of the stack:
        github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...].func1()
        	/home/runner/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.7/expirable/expirable_lru.go:86 +0x1d1
        created by github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...] in goroutine 7
        	/home/runner/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.7/expirable/expirable_lru.go:82 +0x57d
         Goroutine 99 in state select, with github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...].func1 on top of the stack:
        github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...].func1()
        	/home/runner/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.7/expirable/expirable_lru.go:86 +0x1d1
        created by github.com/hashicorp/golang-lru/v2/expirable.NewLRU[...] in goroutine 67
        	/home/runner/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.7/expirable/expirable_lru.go:82 +0x57d
        ]


// Get retrieves the value associated with the given key from the cache.
func (c *TTLCache[K, V]) Get(key K) (V, bool) {
c.mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to add a benchmark test to see how many Gets/second we can handle. Don't imagine this will be a bottleneck anytime soon but would still be good to have a sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

right, tracked via #282

* feat(repository): cache engine-relevant methods

* feat(repository): use generic cacheable function

* improvements

* undo skip
@steebchen steebchen enabled auto-merge (squash) March 21, 2024 17:08
@steebchen steebchen merged commit f82cfb4 into main Mar 21, 2024
16 checks passed
@steebchen steebchen deleted the feat/repository-cache branch March 21, 2024 17:10
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.

None yet

2 participants