Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upload success reported as failure in some cases #134

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method wasn't used. It looks like we moved to SimpleDateFormat, which is definitely 👍 👍

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
Loading