From f7491d7e7bb0d23c68b453e1d5d793867f9a532e Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Thu, 15 Dec 2016 17:33:37 -0500 Subject: [PATCH] bump(bluebird): upgrade bluebird Summary: I upgraded bluebird because I thought there was some missing dependency issue when I booted K2. It actually turned out that the issue was missing `striptags` require in the K2 local-sync package json and had nothing to do with Bluebird. But since were here and about to QA I figured I might as well bump it anyway. Especially since I'll need it later to better diagnose async tests. I carefully went through the 3.0 changelog and believe I fixed the outstanding issues Test Plan: manual Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3523 --- package.json | 2 +- spec_integration/package.json | 2 +- src/K2 | 2 +- src/apm-wrapper.coffee | 8 ++++---- src/flux/stores/draft-store.es6 | 4 +++- src/flux/tasks/reprocess-mail-rules-task.es6 | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 50a67144d..50ce39cff 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "babel-preset-react": "^6.16.0", "babel-regenerator-runtime": "6.5.0", "better-sqlite3": "bengotow/better-sqlite3#a888061ad334c76d2db4c06554c90785cc6e7cce", - "bluebird": "^2.9", + "bluebird": "3.4.x", "chromium-net-errors": "1.0.3", "chrono-node": "^1.1.2", "classnames": "1.2.1", diff --git a/spec_integration/package.json b/spec_integration/package.json index 0fd098f1c..c1f8db015 100644 --- a/spec_integration/package.json +++ b/spec_integration/package.json @@ -11,7 +11,7 @@ "license": "GPL-3.0", "dependencies": { "babel-register": "6.8.x", - "bluebird": "^3.0.5", + "bluebird": "3.4.x", "jasmine": "^2.3.2", "spectron": "^0.34.1", "chalk": "^1.1" diff --git a/src/K2 b/src/K2 index 8319ed3e0..b2f286371 160000 --- a/src/K2 +++ b/src/K2 @@ -1 +1 @@ -Subproject commit 8319ed3e010af9e3f1c6830dcc47627e68675a70 +Subproject commit b2f286371265d18d76a55c372e52801553b9e3fc diff --git a/src/apm-wrapper.coffee b/src/apm-wrapper.coffee index f370a4331..43d5ca36d 100644 --- a/src/apm-wrapper.coffee +++ b/src/apm-wrapper.coffee @@ -87,16 +87,16 @@ class APMWrapper handleProcessErrors(apmProcess, errorMessage, callback) getInstalled: -> - Promise.promisify(@loadInstalled, this)() + Promise.promisify(@loadInstalled, {context: this})() getFeatured: (options = {}) -> - Promise.promisify(@loadFeatured, this)(options) + Promise.promisify(@loadFeatured, {context: this})(options) getOutdated: -> - Promise.promisify(@loadOutdated, this)() + Promise.promisify(@loadOutdated, {context: this})() getPackage: (packageName) -> - @packagePromises[packageName] ?= Promise.promisify(@loadPackage, this, packageName)() + @packagePromises[packageName] ?= Promise.promisify(@loadPackage, {context: this})() satisfiesVersion: (version, metadata) -> engine = metadata.engines?.nylas ? '*' diff --git a/src/flux/stores/draft-store.es6 b/src/flux/stores/draft-store.es6 index c64a68227..2b96cff2a 100644 --- a/src/flux/stores/draft-store.es6 +++ b/src/flux/stores/draft-store.es6 @@ -139,7 +139,9 @@ class DraftStore extends NylasStore { // Important: There are some scenarios where all the promises resolve instantly. // Firing NylasEnv.close() does nothing if called within an existing beforeUnload // handler, so we need to always defer by one tick before re-firing close. - Promise.settle(promises).then(() => { + // NOTE: this replaces Promise.settle: + // http://bluebirdjs.com/docs/api/reflect.html + Promise.all(promises.map(p => p.reflect())).then(() => { this._draftSessions = {}; // We have to wait for accumulateAndTrigger() in the DatabaseStore to // send events to ActionBridge before closing the window. diff --git a/src/flux/tasks/reprocess-mail-rules-task.es6 b/src/flux/tasks/reprocess-mail-rules-task.es6 index 6354197e4..12b88620f 100644 --- a/src/flux/tasks/reprocess-mail-rules-task.es6 +++ b/src/flux/tasks/reprocess-mail-rules-task.es6 @@ -31,7 +31,7 @@ export default class ReprocessMailRulesTask extends Task { } performRemote() { - return Promise.fromNode(this._processAllMessages).thenReturn(Task.Status.Success); + return Promise.fromCallback(this._processAllMessages).thenReturn(Task.Status.Success); } _processAllMessages = (callback) => {