Skip to content

Commit

Permalink
Merge pull request #71 from Infomaniak/fix-track-upload
Browse files Browse the repository at this point in the history
fix: Make track upload as suspend callback
  • Loading branch information
tevincent authored Oct 31, 2024
2 parents 8916777 + 6ada1d1 commit 1f8aae0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class UploadManager(
chunkIndex: Int,
isLastChunk: Boolean,
data: ByteArray,
onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit,
onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit,
): Unit = withContext(Dispatchers.IO) {
val uploadSession = uploadController.getUploadByUUID(uuid)
?: throw NotFoundException("${UploadSession::class.simpleName} not found in DB with uuid = $uuid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class UploadRepository internal constructor(private val uploadRequest: UploadReq
chunkIndex: Int,
isLastChunk: Boolean,
data: ByteArray,
onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit,
onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit,
): Boolean {
return uploadRequest.uploadChunk(uploadHost, containerUUID, fileUUID, chunkIndex, isLastChunk, data, onUpload)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(j
chunkIndex: Int,
isLastChunk: Boolean,
data: ByteArray,
onUpload: (bytesSentTotal: Long, chunkSize: Long) -> Unit,
onUpload: suspend (bytesSentTotal: Long, chunkSize: Long) -> Unit,
): Boolean {
val httpResponse = httpClient.post(
urlString = SharedApiRoutes.uploadChunk(uploadHost, containerUUID, fileUUID, chunkIndex, isLastChunk)
Expand Down

0 comments on commit 1f8aae0

Please sign in to comment.