From 1edf49daf7d400f4b3a64224d93a4783920ca2d2 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Tue, 1 Mar 2016 15:17:20 -0600 Subject: [PATCH] deps: bluebird@3.3.3 - Finishes refactoring started in #6376. - Fixes invalid Promise.map() call. - Cleans up promise (rejection) handling. --- core/server/update-check.js | 33 ++++++++++++--------------------- package.json | 2 +- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/core/server/update-check.js b/core/server/update-check.js index 11e25a15f8..5d16bcd242 100644 --- a/core/server/update-check.js +++ b/core/server/update-check.js @@ -42,7 +42,7 @@ function updateCheckError(error) { api.settings.edit( {settings: [{key: 'nextUpdateCheck', value: Math.round(Date.now() / 1000 + 24 * 3600)}]}, internal - ).catch(errors.rejectError); + ); errors.logError( error, @@ -65,22 +65,19 @@ function updateCheckData() { mailConfig.transport); return Promise.props({ - hash: api.settings.read(_.extend({key: 'dbHash'}, internal)).catch(errors.rejectError).reflect(), - theme: api.settings.read(_.extend({key: 'activeTheme'}, internal)).catch(errors.rejectError).reflect(), + hash: api.settings.read(_.extend({key: 'dbHash'}, internal)).reflect(), + theme: api.settings.read(_.extend({key: 'activeTheme'}, internal)).reflect(), apps: api.settings.read(_.extend({key: 'activeApps'}, internal)) .then(function (response) { var apps = response.settings[0]; - try { - apps = JSON.parse(apps.value); - } catch (e) { - return errors.rejectError(e); - } + + apps = JSON.parse(apps.value); return _.reduce(apps, function (memo, item) { return memo === '' ? memo + item : memo + ', ' + item; }, ''); - }).catch(errors.rejectError).reflect(), - posts: api.posts.browse().catch(errors.rejectError).reflect(), - users: api.users.browse(internal).catch(errors.rejectError).reflect(), - npm: Promise.promisify(exec)('npm -v').catch(errors.rejectError).reflect() + }).reflect(), + posts: api.posts.browse().reflect(), + users: api.users.browse(internal).reflect(), + npm: Promise.promisify(exec)('npm -v').reflect() }).then(function (descriptors) { var hash = descriptors.hash.value().settings[0], theme = descriptors.theme.value().settings[0], @@ -163,20 +160,14 @@ function updateCheckResponse(response) { api.settings.edit( {settings: [{key: 'nextUpdateCheck', value: response.next_check}]}, internal - ).catch(errors.rejectError).reflect(), + ), api.settings.edit( {settings: [{key: 'displayUpdateNotification', value: response.version}]}, internal - ).catch(errors.rejectError).reflect() + ) ); - return Promise.map(ops).then(function then(descriptors) { - descriptors.forEach(function forEach(d) { - if (!d.isFulfilled()) { - errors.rejectError(d.reason()); - } - }); - }); + return Promise.all(ops); } function updateCheck() { diff --git a/package.json b/package.json index cb7d932d00..3fe76510a0 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "bcryptjs": "2.3.0", - "bluebird": "3.1.2", + "bluebird": "3.3.3", "body-parser": "1.14.2", "bookshelf": "0.9.1", "busboy": "0.2.12",