Improvements for sending push performance (#4122)

* Adds test for stalled pushStatus when audience is empty

* fixup! Adds test for stalled pushStatus when audience is empty

* Do not enqueue when count is 0, enforce deviceToken exists, stop badge ordering
This commit is contained in:
Florent Vilmart
2017-08-29 11:47:01 -04:00
committed by GitHub
parent cfd7bc0f3b
commit ea67d23ef4
5 changed files with 92 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
import Parse from 'parse/node';
import Parse from 'parse/node';
import deepcopy from 'deepcopy';
export function isPushIncrementing(body) {
return body.data &&
@@ -28,3 +29,11 @@ export function validatePushType(where = {}, validPushTypes = []) {
}
}
}
export function applyDeviceTokenExists(where) {
where = deepcopy(where);
if (!where.hasOwnProperty('deviceToken')) {
where['deviceToken'] = {'$exists': true};
}
return where;
}