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

bot.close()时不会通知到BotOfflineEvent #1717

Closed
xhzq233 opened this issue Nov 24, 2021 · 1 comment
Closed

bot.close()时不会通知到BotOfflineEvent #1717

xhzq233 opened this issue Nov 24, 2021 · 1 comment
Labels
N 优先级: 一般 s:core 子系统: mirai-core t:bug 类型: bug
Milestone

Comments

@xhzq233
Copy link

xhzq233 commented Nov 24, 2021

能否添加进bot.close()

@Him188 Him188 transferred this issue from mamoe/mirai-console Dec 6, 2021
@Him188 Him188 added N 优先级: 一般 t:problem 类型: 不容易归类为特性或 bug 的综合问题 labels Dec 9, 2021
@Him188 Him188 added this to the Backlog milestone Dec 9, 2021
@Him188 Him188 added the s:core 子系统: mirai-core label Jan 4, 2022
@Him188
Copy link
Member

Him188 commented Jan 14, 2022

经研究, 这个问题的真正原因是名为 "BotOfflineEventBroadcaster" 的 StateChangedObserver (1) 在监听到 OK -> CLOSED 变化时尝试调用 EventDispatcherImpl#broadcastAsync (2) 广播 BotOfflineEvent.Active, 但由于 EventDispatcherCoroutineScope 已经关闭, job 不会启动.


References:

  • (1): QQAndroidBot.kt:123
  • (2): net.mamoe.mirai.internal.network.components.EventDispatcherImpl#broadcastAsync(net.mamoe.mirai.event.Event, kotlin.coroutines.CoroutineContext)

@Him188 Him188 modified the milestones: Backlog, 2.10.0-RC Jan 14, 2022
@Him188 Him188 added t:bug 类型: bug and removed t:problem 类型: 不容易归类为特性或 bug 的综合问题 labels Jan 14, 2022
@Him188 Him188 closed this as completed in b52783d Jan 14, 2022
strear pushed a commit to strear/mirai that referenced this issue Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
N 优先级: 一般 s:core 子系统: mirai-core t:bug 类型: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants