Skip to content

Commit c83dbb1

Browse files
committed
Drop insurmountable cached requests in the user executor
* Context: The user executor stops executing requests from its queue once it hits a request that cannot be sent (yet) since these need to go in order and some requests may be waiting on information from the response to previous request. * When the user executor uncaches any requests, such requests can be: - Fetch Identity by Subscription - only requires an app_id to be sent - Create User - only requires app_id to be sent - Transfer Subscription - requires subscription_id to be sent - Identify User - requires the OSID of the anonymous user to be sent * Of those, we already drop transfer subscription requests who are missing the subscription_id and cannot be hooked up to a model to await the subscription _id. Otherwise, this request will forever block. * In this commit, we add the Identify User request as droppable if it is missing an OSID and it cannot be hooked up to an existing identity model to await the OSID. Otherwise, this request will forever block and remedy calls to `logout` or `login` will just sit in the queue. This scenario leads the SDK to be in a state of having an EUID but forever no OSID, which is needed to make server calls.
1 parent 005a7b6 commit c83dbb1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ class OSUserExecutor {
9191
identityModels[req.identityModelToUpdate.modelId] = req.identityModelToUpdate
9292
} else {
9393
// 4. Both models don't exist yet
94+
// Drop the request if the identityModelToIdentify does not already exist AND the request is missing OSID
95+
// Otherwise, this request will forever fail `prepareForExecution` and block pending requests such as recovery calls to `logout` or `login`
96+
guard request.prepareForExecution() else {
97+
OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor.start() dropped: \(request)")
98+
continue
99+
}
94100
identityModels[req.identityModelToIdentify.modelId] = req.identityModelToIdentify
95101
identityModels[req.identityModelToUpdate.modelId] = req.identityModelToUpdate
96102
}

0 commit comments

Comments
 (0)