Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not mark the empty pushs as failed #4497

Merged
merged 1 commit into from
Jan 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions spec/PushController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -999,16 +999,14 @@ 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');
return query.find({useMasterKey: true}).then((results) => {
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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/Push/PushQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down