From 700bb6867d98dccdc3c0fada7dee66755ab5d8ee Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Sat, 13 Jan 2018 15:12:19 -0500 Subject: [PATCH] Do not mark the empty pushs as failed (#4497) --- spec/PushController.spec.js | 6 ++---- src/Push/PushQueue.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/PushController.spec.js b/spec/PushController.spec.js index 23ce7a60f7..d851037143 100644 --- a/spec/PushController.spec.js +++ b/spec/PushController.spec.js @@ -951,7 +951,7 @@ describe('PushController', () => { }); }); - it('should mark the _PushStatus as failed when audience has no deviceToken', (done) => { + it('should not mark the _PushStatus as failed when audience has no deviceToken', (done) => { var auth = { isMaster: true } @@ -999,8 +999,6 @@ describe('PushController', () => { var config = Config.get(Parse.applicationId); return Parse.Object.saveAll(installations).then(() => { return pushController.sendPush(payload, {}, config, auth) - .then(() => { done.fail('should not success') }) - .catch(() => {}) }).then(() => new Promise(resolve => setTimeout(resolve, 100))); }).then(() => { const query = new Parse.Query('_PushStatus'); @@ -1008,7 +1006,7 @@ describe('PushController', () => { expect(results.length).toBe(1); const pushStatus = results[0]; expect(pushStatus.get('numSent')).toBe(0); - expect(pushStatus.get('status')).toBe('failed'); + expect(pushStatus.get('status')).toBe('succeeded'); done(); }); }).catch((err) => { diff --git a/src/Push/PushQueue.js b/src/Push/PushQueue.js index 095edfc16e..33c84994bd 100644 --- a/src/Push/PushQueue.js +++ b/src/Push/PushQueue.js @@ -38,7 +38,7 @@ export class PushQueue { {limit: 0, count: true}); }).then(({results, count}) => { if (!results || count == 0) { - return Promise.reject({error: 'PushController: no results in query'}) + return pushStatus.complete(); } pushStatus.setRunning(Math.ceil(count / limit)); let skip = 0;