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

clear puppet cache when puppet stop #126

Open
su-chang opened this issue Jan 15, 2021 · 3 comments
Open

clear puppet cache when puppet stop #126

su-chang opened this issue Jan 15, 2021 · 3 comments

Comments

@su-chang
Copy link
Member

related issue: wechaty/puppet-service#31

  public async stop (): Promise<void> {
    this.removeListener('heartbeat', this.feedDog)
    this.watchdog.removeListener('reset', this.dogReset)
    this.removeListener('reset', this.throttleReset)

    this.watchdog.sleep()

    /**
     * FIXME: Huan(202008) clear cache when stop
     *  keep the cache as a temp workaround since wechaty-puppet-hostie has reconnect issue
     *  with un-cleared cache in wechaty-puppet will make the reconnect recoverable
     *
     * Related issue: https://github.com/wechaty/wechaty-puppet-hostie/issues/31
     */
    // this.cacheContactPayload.clear()
    // this.cacheFriendshipPayload.clear()
    // this.cacheMessagePayload.clear()
    // this.cacheRoomPayload.clear()
    // this.cacheRoomInvitationPayload.clear()
    // this.cacheRoomMemberPayload.clear()
  }
@huan
Copy link
Member

huan commented Jan 15, 2021

Thanks for the issue, but I can not remember what this FIXME is for.

Could you please describe in detail what your issue is about?

@su-chang
Copy link
Member Author

Case
A login, A logout, B login, B will get some cache info of A (the same token)

So I think we should clear cache in wechaty-puppet when it stopped

@huan
Copy link
Member

huan commented Jan 15, 2021

OK, I understand, that's the case.

Instead of clear all local cache, I have another solution: save the cache with the token prefix so that the data can be separated from each other (user/tokens), and also when users login after logout with the same token, they can benifites from the cash.

Please feel free to let me know if you have any suggestions, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants