提交 3cc1fa2c 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix race condition for plugin uninstallation

上级 3c9cea4d
......@@ -712,6 +712,15 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
this.version(),
)
/**
* Uninstall Plugins
* no matter the state is `ON` or `OFF`.
*/
while (this.pluginUninstallerList.length > 0) {
const uninstaller = this.pluginUninstallerList.pop()
if (uninstaller) uninstaller()
}
if (this.state.off()) {
log.silly('Wechaty', 'stop() on an stopping/stopped instance')
await this.state.ready('off')
......@@ -728,11 +737,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
this.lifeTimer = undefined
}
while (this.pluginUninstallerList.length > 0) {
const uninstaller = this.pluginUninstallerList.pop()
if (uninstaller) uninstaller()
}
try {
await this.puppet.stop()
} catch (e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册