wechaty / wechaty-puppet-padpro

Apache License 2.0
238 stars 64 forks source link

Upgrade FlashStore to v0.16 (Beta) #191

Closed huan closed 5 years ago

huan commented 5 years ago

The latest version of flash-store used snap-db, which is a pure javascript db, does not require any dependencies.

It will solve two problems:

  1. I believe it will never segment fault anymore because it's pure javascript.
  2. It will be installed without any build tools requirements because it's pure javascript.

See:

windmemory commented 5 years ago

Thanks for the PR, LGTM!

windmemory commented 5 years ago

Seems like there are something wrong with the new version, when I started the bot, it has thus error:

17:56:48 INFO Wechaty <Puppet#0<PuppetPadpro>()/PuppetPadpro#0>(test) start() v0.0.0 is starting...
17:56:48 INFO WechatGateway init(padpro_token, padpro.botorange.com:6666, undefined)
(node:43398) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
17:56:49 INFO CacheManager init()
(node:43398) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at FlashStore.<anonymous> (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:159:1)
    at this (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:1:18)
    at Object.next (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/bundles/flash-store.umd.js:4:53)
    at fulfilled (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:43:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:43398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:43398) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:43398) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token , in JSON at position 2
    at JSON.parse (<anonymous>)
    at FlashStore.<anonymous> (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:159:1)
    at this (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:1:18)
    at Object.next (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/bundles/flash-store.umd.js:4:53)
    at fulfilled (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:43:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:43398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
17:56:53 INFO PadproManager initData() finished with contacts: 26, rooms: 4
(node:43398) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at FlashStore.<anonymous> (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:159:1)
    at this (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:1:18)
    at Object.next (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/bundles/flash-store.umd.js:4:53)
    at fulfilled (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:43:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:43398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:43398) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at FlashStore.<anonymous> (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:159:1)
    at this (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:1:18)
    at Object.next (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/bundles/flash-store.umd.js:4:53)
    at fulfilled (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:43:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:43398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:43398) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at FlashStore.<anonymous> (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:159:1)
    at this (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:1:18)
    at Object.next (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/bundles/flash-store.umd.js:4:53)
    at fulfilled (/Users/yuangao/git/wechaty/wechaty-puppet-padpro/node_modules/flash-store/dist/src/flash-store.js:43:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:43398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
^C

I tried to find the root cause for this, but have no clue yet. My insights for the issue is that, when the bot logged in, it will get the keys in flash-store, which triggered the errors above, but can not find deeper reason for this. Will rollback the version for now.