-
Notifications
You must be signed in to change notification settings - Fork 21
fix: Fix caching in getOrComputeAllDestinationsCommand
#1055
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
Changes from all commits
202f37e
f04cf0b
bf81047
da49da1
87dd83d
64dab3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,7 @@ static GetOrComputeAllDestinationsCommand prepareCommand( | |
|
|
||
| final CacheKey cacheKey = CacheKey.ofTenantOptionalIsolation(); | ||
|
|
||
| cacheKey.append(destinationOptions); | ||
| cacheKey.append(DestinationServiceOptionsAugmenter.getRetrievalStrategy(destinationOptions)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Minor/Suggestion) Overall suggested change looks good! However I think we can improve code quality if we required retrieval-strategy instead of destination-options. It looks like we could easily replace - Function<DestinationOptions, Try<List<DestinationProperties>>> destinationRetriever
+ Function<DestinationServiceRetrievalStrategy, Try<List<DestinationProperties>>> destinationRetriever
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Comment/Question) Can we check implications regarding
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see following problem example: DestinationService loader;
final DestinationOptions optionsInstance =
DestinationOptions
.builder()
.augmentBuilder(
DestinationServiceOptionsAugmenter
.augmenter()
.crossLevelConsumption(DestinationServiceOptionsAugmenter.CrossLevelScope.PROVIDER_SUBACCOUNT))
.build();
// get-all-destinations to CURRENT_TENANT | get-single-destination to ALWAYS_PROVIDER
Try<Destination> destination = loader.tryGetDestination(destinationName, optionsSubaccount); get-all-destinations (for caching) may run on behalf of a different tenant than get-single-destination (lookup)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we need some kind of indicator that disables destination caching for specific destination-option-parameters:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, these beta features such as fragment and cross level will the break change detection and I think they have javadoc that instruct to turn off change detection for them. Similarly, if we add "not found" check we should probably actively check for these. While fragments shouldn't affect the not found check, the cross level scope likely will. In the custom headers, users can also explicitly pass tenant information, so for full safety we should check for those too (compare with API hub for the header details)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this!
(Discussion moved to Slack.) |
||
|
|
||
| final ReentrantLock isolationLock = | ||
| Objects.requireNonNull(isolationLocks.get(cacheKey, any -> new ReentrantLock())); | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Minor/Comment)
Not an ideal solution in my opinion.
But effective enough to keep the discussion going.