From 45af9bddeaf62a6d804879eedddd3ad1fd9e15b9 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sun, 5 Aug 2018 01:43:22 +0300 Subject: [PATCH] fix(macos): fix crashes under Mac OS X --- src/background/background.js | 10 ++++++++-- src/background/config.js | 2 +- src/background/feed.js | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/background/background.js b/src/background/background.js index 297d69a..347d797 100644 --- a/src/background/background.js +++ b/src/background/background.js @@ -295,8 +295,14 @@ const stop = () => { if(mainWindow) mainWindow.hide() - if(tray) - tray.destroy() + // bug with mac os tray closing + // https://github.com/electron/electron/issues/9982 + // https://github.com/electron/electron/issues/13556 + if(process.platform !== 'darwin') + { + if(tray) + tray.destroy() + } if(spider) { diff --git a/src/background/config.js b/src/background/config.js index 947c2b4..038898c 100644 --- a/src/background/config.js +++ b/src/background/config.js @@ -28,7 +28,7 @@ let config = { sphinx: { host : '127.0.0.1', port : 9306, - connectionLimit: 12 + connectionLimit: 10 }, spider: { diff --git a/src/background/feed.js b/src/background/feed.js index d5d674b..4ed6e5e 100644 --- a/src/background/feed.js +++ b/src/background/feed.js @@ -23,7 +23,7 @@ module.exports = class Feed { config.feedDate = this.feedDate await this.sphinx.query('delete from feed where id > 0') let id = 0 - return Promise.all( + await Promise.all( this.feed.map( async record => await this.sphinx.query('insert into feed(id, data) values(?, ?)', [++id, JSON.stringify(record)]) )