Increase timeout, close #28

This commit is contained in:
Him188 2020-04-09 12:27:34 +08:00
parent 3a8b2dd6d2
commit 8f4313a337

View File

@ -550,9 +550,9 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
class TimeoutException(override val message: String?) : Exception()
/**
* 发送一个包, 挂起直到接收到指定的返回包或超时(3000ms)
* 发送一个包, 挂起协程直到接收到指定的返回包或超时
*/
suspend fun <E : Packet> OutgoingPacket.sendAndExpect(timeoutMillis: Long = 3000, retry: Int = 2): E {
suspend fun <E : Packet> OutgoingPacket.sendAndExpect(timeoutMillis: Long = 5000, retry: Int = 2): E {
require(timeoutMillis > 100) { "timeoutMillis must > 100" }
require(retry >= 0) { "retry must >= 0" }