Fix issue _PushStatus stuck sending (#3808)

* Adds test for not set device tokens

* Properly filter the installations without a deviceToken

* nit for slower PG test

* nit
This commit is contained in:
Florent Vilmart
2017-05-12 14:24:37 -04:00
committed by GitHub
parent 4a724e8ab1
commit 88de01f3d8
2 changed files with 81 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import { ParseMessageQueue } from '../ParseMessageQueue';
import rest from '../rest';
import { isPushIncrementing } from './utils';
import deepcopy from 'deepcopy';
const PUSH_CHANNEL = 'parse-server-push';
const DEFAULT_BATCH_SIZE = 100;
@@ -27,7 +28,10 @@ export class PushQueue {
// Order by badge (because the payload is badge dependant)
// and createdAt to fix the order
const order = isPushIncrementing(body) ? 'badge,createdAt' : 'createdAt';
where = deepcopy(where);
if (!where.hasOwnProperty('deviceToken')) {
where['deviceToken'] = {'$exists': true};
}
return Promise.resolve().then(() => {
return rest.find(config,
auth,