mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-10 20:15:03 +08:00
CuiCloud retry
This commit is contained in:
parent
f33c7da7b3
commit
00aea20c2c
@ -15,6 +15,7 @@ import io.ktor.client.request.post
|
|||||||
import io.ktor.client.statement.HttpResponse
|
import io.ktor.client.statement.HttpResponse
|
||||||
import io.ktor.http.isSuccess
|
import io.ktor.http.isSuccess
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
@ -84,14 +85,15 @@ object CuiCloud {
|
|||||||
val bytes = file.readBytes()
|
val bytes = file.readBytes()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
retryCatching(5) {
|
retryCatching(50) {
|
||||||
uploadToCuiCloud(
|
uploadToCuiCloud(
|
||||||
cuiCloudUrl,
|
cuiCloudUrl,
|
||||||
key,
|
key,
|
||||||
"/mirai/${project.name}/${file.nameWithoutExtension}.mp4",
|
"/mirai/${project.name}/${file.nameWithoutExtension}.mp4",
|
||||||
bytes
|
bytes
|
||||||
)
|
)
|
||||||
}
|
delay(30_000)
|
||||||
|
}.getOrThrow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user