Skip to content

Commit

Permalink
fixup! IamFetchReadyCondition Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezp committed Sep 27, 2024
1 parent 55a3e25 commit 5873b16
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ class IamFetchReadyCondition(
override fun isMet(indexedTokens: Map<String, Map<IConsistencyKeyEnum, String>>): Boolean {
val tokenMap = indexedTokens[key] ?: return false
val userUpdateTokenSet = tokenMap[IamFetchRywTokenKey.USER] != null
val subscriptionUpdateTokenSet = tokenMap[IamFetchRywTokenKey.SUBSCRIPTION] != null

/**
* We always update the session count so we know we will have a userUpdateToken. We don't
* necessarily make a subscriptionUpdate call on every session. The following logic
* is written in a way so that if somehow the subscriptionUpdateToken is set *before* the
* userUpdateToken, we will wait for the userUpdateToken to also be set. This is because
* we know that a userUpdate call was made and both user & subscription properties are
* considered during segment calculations.
* doesn't consider tokenMap[IamFetchRywTokenKey.SUBSCRIPTION] for this reason. This doesn't
* mean it isn't considered if present when doing the token comparison.
*/
return (userUpdateTokenSet && subscriptionUpdateTokenSet) || userUpdateTokenSet
return userUpdateTokenSet
}

override fun getNewestToken(indexedTokens: Map<String, Map<IConsistencyKeyEnum, String?>>): String? {
Expand Down

0 comments on commit 5873b16

Please sign in to comment.