You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/outcomes/impl/OutcomeEventsController.kt
@@ -75,10 +76,15 @@ internal class OutcomeEventsController(
75
76
76
77
_outcomeEventsCache.deleteOldOutcomeEvent(event)
77
78
} catch (ex:BackendException) {
78
-
Logging.warn(
79
-
"""OutcomeEventsController.sendSavedOutcomeEvent: Sending outcome with name: ${event.outcomeId} failed with status code: ${ex.statusCode} and response: ${ex.response}
80
-
Outcome event was cached and will be reattempted on app cold start""",
81
-
)
79
+
val responseType =NetworkUtils.getResponseStatusType(ex.statusCode)
80
+
val err ="OutcomeEventsController.sendSavedOutcomeEvent: Sending outcome with name: ${event.outcomeId} failed with status code: ${ex.statusCode} and response: ${ex.response}"
81
+
82
+
if (responseType ==NetworkUtils.ResponseStatusType.RETRYABLE) {
83
+
Logging.warn("$err Outcome event was cached and will be reattempted on app cold start")
84
+
} else {
85
+
Logging.error("$err Outcome event will be omitted!")
86
+
_outcomeEventsCache.deleteOldOutcomeEvent(event)
87
+
}
82
88
}
83
89
}
84
90
@@ -220,14 +226,19 @@ Outcome event was cached and will be reattempted on app cold start""",
220
226
// The only case where an actual success has occurred and the OutcomeEvent should be sent back
"""OutcomeEventsController.sendAndCreateOutcomeEvent: Sending outcome with name: $name failed with status code: ${ex.statusCode} and response: ${ex.response}
225
-
Outcome event was cached and will be reattempted on app cold start""",
226
-
)
227
-
228
-
// Only if we need to save and retry the outcome, then we will save the timestamp for future sending
229
-
eventParams.timestamp = timestampSeconds
230
-
_outcomeEventsCache.saveOutcomeEvent(eventParams)
229
+
val responseType =NetworkUtils.getResponseStatusType(ex.statusCode)
230
+
val err ="OutcomeEventsController.sendAndCreateOutcomeEvent: Sending outcome with name: $name failed with status code: ${ex.statusCode} and response: ${ex.response}"
231
+
232
+
if (responseType ==NetworkUtils.ResponseStatusType.RETRYABLE) {
233
+
Logging.warn("$err Outcome event was cached and will be reattempted on app cold start")
234
+
235
+
// Only if we need to save and retry the outcome, then we will save the timestamp for future sending
236
+
eventParams.timestamp = timestampSeconds
237
+
_outcomeEventsCache.saveOutcomeEvent(eventParams)
238
+
} else {
239
+
Logging.error("$err Outcome event will be omitted!")
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/outcomes/impl/OutcomeEventsRepository.kt
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/outcomes/migrations/RemoveInvalidSessionTimeRecords.kt
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/test/java/com/onesignal/session/internal/outcomes/OutcomeEventsControllerTests.kt
+101Lines changed: 101 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -723,4 +723,105 @@ class OutcomeEventsControllerTests : FunSpec({
0 commit comments