Skip to content

Commit c9dbe18

Browse files
committed
don't re-create user on failed del alias attempts
We incorrectly assumed that getting a 404 or a 410 from DELETE users/by/$aliasLabel/$aliasValue/identity/$aliasLabelToDelete means the user is gone. It could mean either the User and/or the Alias is gone, either way the end state is the same, the alias no longer exists on that User. If the User was really delete we will know on the next User operation, and that will handle the create User. This fixes a bug where the OperationRepo gets stuck in a loop trying to create the user over-and-over again if OneSignal.User.deleteAlias is called twice in a row with the same label. With the current SDK logic, the retrying was be done with a backoff, so retrying won't have had much of an impact on the OneSignal's backend load on 5.1.7 and later, but did on 5.0.0 to 5.1.6.
1 parent 1c9bf66 commit c9dbe18

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/user/internal/operations/impl/executors/IdentityOperationExecutor.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ internal class IdentityOperationExecutor(
103103
NetworkUtils.ResponseStatusType.UNAUTHORIZED ->
104104
ExecutionResponse(ExecutionResult.FAIL_UNAUTHORIZED)
105105
NetworkUtils.ResponseStatusType.MISSING -> {
106-
val operations = _buildUserService.getRebuildOperationsIfCurrentUser(lastOperation.appId, lastOperation.onesignalId)
107-
if (operations == null) {
108-
return ExecutionResponse(ExecutionResult.FAIL_NORETRY)
109-
} else {
110-
return ExecutionResponse(ExecutionResult.FAIL_RETRY, operations = operations)
111-
}
106+
// This means either the User or the Alias was already
107+
// deleted, either way the end state is the same, the
108+
// alias no longer exists on that User.
109+
ExecutionResponse(ExecutionResult.SUCCESS)
112110
}
113111
}
114112
}

0 commit comments

Comments
 (0)