Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clarifying comment re: why we track RYW tokens for user create as well
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
Rodrigo Gomez Palacio committed Oct 23, 2024
commit 75eab0f355d5ad281fb5e675d3e7ac4210d54db3
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
Loading