Skip to content

Commit

Permalink
Clarifying comment re: why we track RYW tokens for user create as well
Browse files Browse the repository at this point in the history
Motivation: On fresh installs, we don't yet have a user or a subscription to update so we wouldn't get a RYW token until those requests are executed (5 seconds later when the operations are processed)
  • Loading branch information
rgomezp committed Oct 23, 2024
1 parent 92b0309 commit cf0e90f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import Foundation

public enum OSIamFetchOffsetKey: Int, OSConsistencyKeyEnum {
// We track user create tokens as well because on fresh installs, we don't have a user or subscription
// to update, which would lead to a 5 second delay until the subsequent user & subscription update calls
// give us RYW tokens
case userCreate = 0
case userUpdate = 1
case subscriptionUpdate = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
public func isMet(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> Bool {
guard let tokenMap = indexedTokens[id] else { return false }

// We track user create tokens as well because on fresh installs, we don't have a user or subscription
// to update, which would lead to a 5 second delay until the subsequent user & subscription update calls
// give us RYW tokens
let userCreateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userCreate.rawValue)] != nil
let userUpdateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userUpdate.rawValue)] != nil
let subscriptionTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.subscriptionUpdate.rawValue)] != nil
Expand Down

0 comments on commit cf0e90f

Please sign in to comment.