Skip to content

Commit

Permalink
fix: upload success reported as failure in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em committed May 13, 2024
1 parent 54b31e7 commit 8ef14ba
Showing 1 changed file with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ internal class UploadMetrics private constructor() {

private val logger get() = MuxUploadSdk.logger


private fun formatMilliseconds(ms:Long):String {
return String.format("%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(ms),
TimeUnit.MILLISECONDS.toMinutes(ms) -
TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(ms)), // The change is in this line
TimeUnit.MILLISECONDS.toSeconds(ms) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(ms)));
}

private suspend fun getEventInfo(startTimeMillis: Long,
startTimeKey: String,
endTimeMillis: Long,
Expand Down Expand Up @@ -125,8 +115,8 @@ internal class UploadMetrics private constructor() {
maximumResolution:String,
sessionId: String,
uploadInfo: UploadInfo
) {
var body = JSONObject()
) = runCatching {
val body = JSONObject()
body.put("type", "upload_input_standardization_succeeded")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -149,8 +139,8 @@ internal class UploadMetrics private constructor() {
maximumResolution:String,
sessionId: String,
uploadInfo: UploadInfo
) {
var body = JSONObject()
) = runCatching {
val body = JSONObject()
body.put("type", "upload_input_standardization_failed")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -172,8 +162,8 @@ internal class UploadMetrics private constructor() {
inputFileDurationMs: Long,
sessionId: String,
uploadInfo: UploadInfo
) {
var body = JSONObject()
) = runCatching {
val body = JSONObject()
body.put("type", "upload_succeeded")
body.put("session_id", sessionId)
body.put("version", "1")
Expand All @@ -193,8 +183,8 @@ internal class UploadMetrics private constructor() {
errorDescription:String,
sessionId: String,
uploadInfo: UploadInfo
) {
var body = JSONObject()
) = runCatching {
val body = JSONObject()
body.put("type", "uploadfailed")
body.put("session_id", sessionId)
body.put("version", "1")
Expand Down

0 comments on commit 8ef14ba

Please sign in to comment.