Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
In our attempts to deal with rate limiting when sending push notifications to a huge installation base, we tried to batch them and only send 5000 push noticiations per 30 seconds. We tried to set limit
and skip
for a ParseQuery
to loop until all items are iterated on. This is our code:
async function batchPush(query: Parse.Query<Parse.Installation>, data: PushData, total: number) {
let skip = 0;
const batchSize = 5_000;
const interBatchDelay = 30 * 1_000; // 30,000ms = 30 Seconds
query.limit(batchSize);
query.skip(skip);
while (skip < total) {
await Parse.Push.send({ where: query, data }, { useMasterKey: true });
await sleep(interBatchDelay);
skip = skip + batchSize;
query.skip(skip);
}
return true;
}
But as it turns out, the limit
and skip
values from the ParseQuery
are ignored by Parse.Push.send
, sending it to all installations instead:
Lines 54 to 57 in 98674f0
It seems it will only look at the where
part of the ParseQuery
, ignoring the limit and skip. As a result our loop still sends notifications to the entire installation base.
Steps to reproduce
Set limit
and skip
of a ParseQuery
used in Parse.Push.send
Actual Outcome
limit
and skip
are ignored
Expected Outcome
Only the specified range should receive push notifications.
Environment
Client
- Parse JS SDK version:
4.1.0