Push: Cleanup invalid device tokens (#4149)

* Adds collecting invalid / expired device tokens from GCM / APNS

* Cleanup invalid installations based on responses from the adapters

* Adds test for cleanup

* Adds tests for removal
This commit is contained in:
Florent Vilmart
2017-09-12 14:53:05 -04:00
committed by GitHub
parent a1554d04ab
commit 3a17904ce8
3 changed files with 111 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import { pushStatusHandler } from '../StatusHandler';
import * as utils from './utils';
import { ParseMessageQueue } from '../ParseMessageQueue';
import { PushQueue } from './PushQueue';
import logger from '../logger';
function groupByBadge(installations) {
return installations.reduce((map, installation) => {
@@ -80,6 +81,7 @@ export class PushWorker {
}
if (!utils.isPushIncrementing(body)) {
logger.verbose(`Sending push to ${installations.length}`);
return this.adapter.send(body, installations, pushStatus.objectId).then((results) => {
return pushStatus.trackSent(results);
});