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

登录或重连时遇到 timeout (TimeoutCancellationException) 时没有重连 #2504

Closed
Him188 opened this issue Feb 15, 2023 · 0 comments · Fixed by #2505
Closed

登录或重连时遇到 timeout (TimeoutCancellationException) 时没有重连 #2504

Him188 opened this issue Feb 15, 2023 · 0 comments · Fixed by #2505
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug
Milestone

Comments

@Him188
Copy link
Member

Him188 commented Feb 15, 2023

可添加 test 复现:

net.mamoe.mirai.internal.network.impl.common.CommonNHBotNormalLoginTest#test first login failed with CancellationException

    @Test
    fun `test first login failed with CancellationException`() = runBlockingUnit {
        var first = true
        setSsoProcessor {
            if (first) {
                first = false
                throw CancellationException("Timed out!")
            }
        }
        bot.login()
        assertState(NetworkHandler.State.OK)
    }

注意此测试仅供参考, 实际上不能捕获 CancellationException, 而只能捕获 TimeoutCancellationException. 因为 CancellationException 可能是用户发起的

@Him188 Him188 added t:bug 类型: bug M 优先级: 主要 s:core 子系统: mirai-core labels Feb 15, 2023
@Him188 Him188 added this to the Backlog milestone Feb 15, 2023
sandtechnology added a commit to sandtechnology/mirai that referenced this issue Feb 15, 2023
Him188 pushed a commit that referenced this issue Feb 19, 2023
 #2504, fix #2488 (#2505)

* #2504,#2488 handle TimeoutCancellationException when resuming connection

* Remove unnecessary code and fix wording

* Use yield() instead of delay

* Use yield() instead of delay
@Him188 Him188 modified the milestones: Backlog, 2.15.0-RC Feb 19, 2023
@Him188 Him188 modified the milestones: 2.15.0-RC, 2.15.0-M1 Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant