Skip to content

Commit

Permalink
style: remove unnecessary else from FlushQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Nov 24, 2023
1 parent c32302f commit 2c0ce6e
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions parsely/src/main/java/com/parsely/parselyandroid/FlushQueue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ internal class FlushQueue(
ParselyTracker.PLog("Debug mode on. Not sending to Parse.ly. Otherwise, would sent ${eventsToSend.size} events")
repository.remove(eventsToSend)
return@launch
} else {
ParselyTracker.PLog("Sending request with %d events", eventsToSend.size)
val jsonPayload = toParselyEventsPayload(eventsToSend)
ParselyTracker.PLog("POST Data %s", jsonPayload)
ParselyTracker.PLog("Requested %s", ParselyTracker.ROOT_URL)
restClient.send(jsonPayload)
.fold(
onSuccess = {
ParselyTracker.PLog("Pixel request success")
repository.remove(eventsToSend)
ParselyTracker.PLog("Event queue empty, flush timer cleared.")
if (repository.getStoredQueue().isEmpty()) {
flushManager.stop()
}
},
onFailure = {
ParselyTracker.PLog("Pixel request exception")
ParselyTracker.PLog(it.toString())
}
)
}
ParselyTracker.PLog("Sending request with %d events", eventsToSend.size)
val jsonPayload = toParselyEventsPayload(eventsToSend)
ParselyTracker.PLog("POST Data %s", jsonPayload)
ParselyTracker.PLog("Requested %s", ParselyTracker.ROOT_URL)
restClient.send(jsonPayload)
.fold(
onSuccess = {
ParselyTracker.PLog("Pixel request success")
repository.remove(eventsToSend)
ParselyTracker.PLog("Event queue empty, flush timer cleared.")
if (repository.getStoredQueue().isEmpty()) {
flushManager.stop()
}
},
onFailure = {
ParselyTracker.PLog("Pixel request exception")
ParselyTracker.PLog(it.toString())
}
)
}
}
}
Expand Down

0 comments on commit 2c0ce6e

Please sign in to comment.