Skip to content

Commit 302c761

Browse files
committed
Prevent retries when a message is deleted before the event is sent
1 parent 8bbad56 commit 302c761

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

android/app/src/main/java/com/httpsms/HttpSmsApiService.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ class HttpSmsApiService(private val apiKey: String, private val baseURL: URI) {
152152
.build()
153153

154154
val response = client.newCall(request).execute()
155+
if (response.code == 404) {
156+
response.close()
157+
Timber.i( "[$event] event sent successfully but message with ID [$messageId] has been deleted" )
158+
return true
159+
}
160+
155161
if (!response.isSuccessful) {
156162
Timber.e("error response [${response.body?.string()}] with code [${response.code}] while sending [${event}] event [${body}] for message with ID [${messageId}]")
157163
response.close()

0 commit comments

Comments
 (0)