-
Notifications
You must be signed in to change notification settings - Fork 6
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: Cache configuration for a given ClientSession #959
Conversation
Sources/PrimerSDK/Classes/PCI/Services/DefaultNetworkService.swift
Outdated
Show resolved
Hide resolved
Sources/PrimerSDK/Classes/Services/Network/PrimerAPIClientProtocol.swift
Show resolved
Hide resolved
Generated by 🚫 Danger Swift against 9663e6d |
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.
LGTM
Appetize link: https://appetize.io/app/n35mr4afuvpmun6svd3i3icswm |
@@ -714,6 +729,8 @@ struct SDKProperties: Codable { | |||
self.sdkSettings = try container.decodeIfPresent([String: AnyCodable].self, forKey: .sdkSettings) | |||
self.sdkType = try container.decodeIfPresent(String.self, forKey: .sdkType) | |||
self.sdkVersion = try container.decodeIfPresent(String.self, forKey: .sdkVersion) | |||
self.context = try container.decodeIfPresent([String: AnyCodable].self, forKey: .context) |
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.
nit: We have a (spurious ..) extension to decode [String: Any]
- could use that to keep this symmetric.
} | ||
|
||
func setData(_ data: ConfigurationCachedData, forKey key: String) { | ||
// Cache includes at most one cached configuration |
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.
Is there a potential case for having a SingleItemCache
wrapper around NSCache
instead? Then the key could be passed in the init and removed from all the upstream methods here
My concern would be someone seeing this and thinking that it supports multiple configurations because of the provision of a key
Sources/PrimerSDK/Classes/Core/Payment Services/PrimerAPIConfigurationModule.swift
Outdated
Show resolved
Hide resolved
} | ||
|
||
promise.ensure { | ||
PrimerAPIConfigurationModule.queue.async { |
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.
I suspect there is a small chance here that you could end up adding a callback here that is never returned because it was added after ensure was called but prior to the queued item completing.
I don't think this will play out in practice but worth thinking of whether there's a way to further streamline the promise-nesting to avoid this in the future. (Which is admittedly easier said than done!)
…t flag is true (#957) * Validate PENDING in resume if flag is true * Remove unused code * Added unit tests for CreateResumeService * Make new flag a bool * Added strings for fintechture * Remove redundant enum * Split out createresume into seperate protocol
[create-pull-request] automated change Co-authored-by: NQuinn27 <3179752+NQuinn27@users.noreply.github.com>
Quality Gate passedIssues Measures |
Description
ACC-3672
DPS-587
This PR introduces a Configuration Cache which will avoid hitting
/configuration
when the Config for a clientToken has been cached.Manual Testing
Manual Testing can be done on another branch, to come. (Hybrid Checkout)
Contributor Checklist
Reviewer Checklist
Before Merging
Other Stuff