mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 23:20:09 +08:00
show ptt upload speed
This commit is contained in:
parent
4b26d4d2c2
commit
2ae91bb216
@ -186,6 +186,7 @@ internal object HighwayHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun uploadPttToServers(
|
suspend fun uploadPttToServers(
|
||||||
|
bot: QQAndroidBot,
|
||||||
servers: List<Pair<Int, Int>>,
|
servers: List<Pair<Int, Int>>,
|
||||||
content: ByteArray,
|
content: ByteArray,
|
||||||
md5: ByteArray,
|
md5: ByteArray,
|
||||||
@ -194,8 +195,18 @@ internal object HighwayHelper {
|
|||||||
servers.retryWithServers(10 * 1000, {
|
servers.retryWithServers(10 * 1000, {
|
||||||
throw IllegalStateException("cannot upload ptt, failed on all servers.", it)
|
throw IllegalStateException("cannot upload ptt, failed on all servers.", it)
|
||||||
}, { s: String, i: Int ->
|
}, { s: String, i: Int ->
|
||||||
|
bot.network.logger.verbose {
|
||||||
|
"[Highway] Uploading ptt to ${s}:$i, size=${content.size.toLong().sizeToString()}"
|
||||||
|
}
|
||||||
|
val time = measureTime {
|
||||||
uploadPttToServer(s, i, content, md5, uKey, fileKey)
|
uploadPttToServer(s, i, content, md5, uKey, fileKey)
|
||||||
|
}
|
||||||
|
bot.network.logger.verbose {
|
||||||
|
"[Highway] Uploading ptt: succeed at ${(content.size.toDouble() / 1024 / time.inSeconds).roundToInt()} KiB/s"
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun uploadPttToServer(
|
private suspend fun uploadPttToServer(
|
||||||
|
Loading…
Reference in New Issue
Block a user