Skip to content

Conversation

@jmank88
Copy link
Contributor

@jmank88 jmank88 commented Jan 26, 2026

@github-actions
Copy link

github-actions bot commented Jan 26, 2026

✅ API Diff Results - No breaking changes


📄 View full apidiff report

@jmank88 jmank88 force-pushed the CRE-1707-limits-org-id branch 2 times, most recently from be861a7 to 266bb5c Compare February 2, 2026 23:27
@jmank88 jmank88 marked this pull request as ready for review February 3, 2026 11:59
@jmank88 jmank88 requested a review from a team as a code owner February 3, 2026 11:59
Comment on lines +10 to +11
cacheDurationOrg = 24 * time.Hour
cacheDurationError = time.Minute
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@patrickhuie19 are these reasonable? Do we need to be able to reconfigure them?

@jmank88 jmank88 requested a review from pavel-raykov February 3, 2026 12:52
stop, done chan struct{}
}

func NewCache(orgResolver OrgResolver) OrgResolver {
Copy link
Contributor

Choose a reason for hiding this comment

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

would not you like just to wrap github.com/hashicorp/golang-lru/v2/expirable ?

For example, it does not have additional background routines and only updates stuff once it is read

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, taking it back - seems a different type of hash. However, I still have this question - why do you need the background reap routine? Cannot you update the entries whenever you read them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was being overly cautious about memory leaks 🤷 Could manage a max size instead, but that seems to come with other complexities 🤷 Open to suggestions though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, we already use external cache in a couple of places https://github.com/search?q=org%3Asmartcontractkit+%22jellydator%2Fttlcache%22&type=code .

So, I would suggest to do the same here - use https://pkg.go.dev/github.com/jellydator/ttlcache which ensures that the cache does not leak and has customizable behavior for the load.

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