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: Make track upload as suspend callback #71

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
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 @@ -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
Loading