[9.0] fix: cache the proxy strength (not changing that often...)#8154
Merged
chrisburr merged 1 commit intoDIRACGrid:integrationfrom Apr 15, 2025
Merged
[9.0] fix: cache the proxy strength (not changing that often...)#8154chrisburr merged 1 commit intoDIRACGrid:integrationfrom
chrisburr merged 1 commit intoDIRACGrid:integrationfrom
Conversation
chaen
reviewed
Apr 14, 2025
|
|
||
| _cache_getProxyStrength = TTLCache(maxsize=1000, ttl=600) | ||
|
|
||
| @cached(_cache_getProxyStrength, lock=Lock()) |
Contributor
There was a problem hiding this comment.
I am not sure it is a good idea to have a lock there. Given that the result is deterministic, we don't really care if the cache is filled several times, do we ?
Contributor
Author
There was a problem hiding this comment.
I am not sure, but according to the documentation these classes are not thread-safe, so I'd leave the lock. At the same time I think to put (maxsize=100, ttl=3600).
chrisburr
reviewed
Apr 15, 2025
Comment on lines
+401
to
+403
| _cache_getProxyStrength = TTLCache(maxsize=1000, ttl=600) | ||
|
|
||
| @cached(_cache_getProxyStrength, lock=Lock()) |
Member
There was a problem hiding this comment.
I don't think there is any point in having a longer TTL than 10 minutes. It's already an eternity compared to the frequency with which this is called.
Suggested change
| _cache_getProxyStrength = TTLCache(maxsize=1000, ttl=600) | |
| @cached(_cache_getProxyStrength, lock=Lock()) | |
| @cached(TTLCache(maxsize=1000, ttl=600), lock=Lock()) |
f1aa19e to
11ae785
Compare
chrisburr
approved these changes
Apr 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given that anyway 90%+ of the calls would be for the same proxy over and over
BEGINRELEASENOTES
*Framework
FIX: Caching the proxy strength to avoid a DB call
ENDRELEASENOTES