Skip to content

Commit 7dac0c1

Browse files
authored
Merge pull request #2245 from DataDog/release/2.13.0
Release/2.13.0
2 parents 1f08228 + 7c4b3d9 commit 7dac0c1

File tree

5 files changed

+685
-469
lines changed

5 files changed

+685
-469
lines changed

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/data/upload/DataOkHttpUploader.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,16 @@ internal class DataOkHttpUploader(
183183
): UploadStatus {
184184
return when (code) {
185185
HTTP_ACCEPTED -> UploadStatus.Success(code)
186-
HTTP_BAD_REQUEST -> UploadStatus.HttpClientError(code)
187-
HTTP_UNAUTHORIZED -> UploadStatus.InvalidTokenError(code)
186+
187+
HTTP_UNAUTHORIZED,
188188
HTTP_FORBIDDEN -> UploadStatus.InvalidTokenError(code)
189-
HTTP_CLIENT_TIMEOUT -> UploadStatus.HttpClientRateLimiting(code)
190-
HTTP_ENTITY_TOO_LARGE -> UploadStatus.HttpClientError(code)
189+
190+
HTTP_CLIENT_TIMEOUT,
191191
HTTP_TOO_MANY_REQUESTS -> UploadStatus.HttpClientRateLimiting(code)
192+
193+
HTTP_BAD_REQUEST,
194+
HTTP_ENTITY_TOO_LARGE -> UploadStatus.HttpClientError(code)
195+
192196
HTTP_INTERNAL_ERROR,
193197
HTTP_BAD_GATEWAY,
194198
HTTP_UNAVAILABLE,

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/data/upload/UploadStatus.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal sealed class UploadStatus(
1515
) {
1616

1717
internal class Success(responseCode: Int) : UploadStatus(shouldRetry = false, code = responseCode)
18+
1819
internal class NetworkError(throwable: Throwable) : UploadStatus(shouldRetry = true, throwable = throwable)
1920
internal class DNSError(throwable: Throwable) : UploadStatus(shouldRetry = true, throwable = throwable)
2021
internal class RequestCreationError(throwable: Throwable?) :
@@ -26,6 +27,7 @@ internal sealed class UploadStatus(
2627
internal class HttpServerError(responseCode: Int) : UploadStatus(shouldRetry = true, code = responseCode)
2728
internal class HttpClientRateLimiting(responseCode: Int) : UploadStatus(shouldRetry = true, code = responseCode)
2829
internal class UnknownHttpError(responseCode: Int) : UploadStatus(shouldRetry = false, code = responseCode)
30+
2931
internal class UnknownException(throwable: Throwable) : UploadStatus(shouldRetry = true, throwable = throwable)
3032

3133
internal object UnknownStatus : UploadStatus(shouldRetry = false, code = UNKNOWN_RESPONSE_CODE)

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/data/upload/UploadWorker.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ internal class UploadWorker(
9797
RemovalReason.IntakeCode(uploadStatus.code),
9898
deleteBatch = !uploadStatus.shouldRetry
9999
)
100-
@Suppress("UnsafeThirdPartyFunctionCall") // safe to add
101-
taskQueue.offer(UploadNextBatchTask(taskQueue, sdkCore, feature))
100+
if (uploadStatus is UploadStatus.Success) {
101+
@Suppress("UnsafeThirdPartyFunctionCall") // safe to add
102+
taskQueue.offer(UploadNextBatchTask(taskQueue, sdkCore, feature))
103+
}
102104
}
103105
}
104106

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/metrics/RemovalReason.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal sealed class RemovalReason {
1111
internal fun includeInMetrics(): Boolean {
1212
return this !is Flushed
1313
}
14-
internal class IntakeCode(private val responseCode: Int) : RemovalReason() {
14+
internal data class IntakeCode(private val responseCode: Int) : RemovalReason() {
1515
override fun toString(): String {
1616
return "intake-code-$responseCode"
1717
}

0 commit comments

Comments
 (0)