-
-
Notifications
You must be signed in to change notification settings - Fork 596
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
Parse.Push.send()
ignores ParseQuery limit and skip parameters
#1956
Comments
Thanks for opening this issue!
|
Parse.Push.send()
ignores ParseQuery limit and skip parameters
I'm pretty sure that push notifications are sent to the push provider API in batches internally in the push adapter. At least for FCM I think, if not also for APNS. In any case, if the installation query fetched all objects at once that would not be optimal, as it would need to hold potentially large amounts of data in memory. The risk of using |
Thanks for your thoughtful response. I'm working with @shlusiak on this. So you're saying you believe the omission of Interestingly the reason we are attempting a batching system at our end is that we observed that the number of successful deliveries of a bulk push to all users of our app, dropped by about a third overnight, and has remained at that lower level ever since. We could not find a reason for this. After some discussion on the Parse Community Slack group, we decided that we may be trying to send too many pushes at the same time, and a batching process at our end could alleviate that. If batching is already implemented in the adaptor, then we are probably incorrect in trying that. |
Yes, not supporting these pagination params could have been intentional, but these risk are not unique to the Installation class, so I don't see any reason we couldn't allow them. Sending in batches may not be supported in the push adapter for all APIs, you would need to check. You can turn on push adapter verbose logs to see why requests are failing. In fact, if they fail with an error, that error should be logged in any case in the Parse Server logs, including the API response code and message. |
Yes, we've done that, but we're having trouble interpreting what we're seeing. Without wanting to turn this issue report into an impromptu support discussion, I see you've been quite active in discussions of push issues. Do you know if there could be an issue with an excessive number of invalid device tokens? We've never performed a cleanup, and even before the sudden drop in deliveries, our successful deliveries were only about a quarter of our total installations. Is there, by any chance, a point at which APNS bails out due to excessive invalid tokens, or anything like that? |
APNS may in fact bail out due to excessive invalid device tokens, it would return error In more detail, APNS does not in every case know whether a device token is valid or not. This is an effect of how Apple invalidates device tokens and tracks app uninstalls on end-user devices. In any case it's the end-user device that makes the final decision on whether to display the push notifications to the user. That can cause invalid device tokens sent by Parse Server to not receive a How this could affect your app varies. Invalid device tokens that are not reported as invalid by APNS and don't get cleaned up will of course increase the ratio of failed push notifications over time. This can lead to edge cases, for example, if your users often un- and then re-install your app, then an individual user may have many Parse Server Installation objects with device tokens of which only 1 token is currently valid. If your push query selects all these installations where a specific user is set, then APNS may reject push notifications on a "per device" (not per token) quota. This is different from general API throttling and may affect only specific users. It really depends on what your scenario is, what errors you're getting from APNS and what your users are reporting. Also maybe interesting: parse-community/parse-server-push-adapter#107 (comment) |
I think we may close this specific issue, unless you still think that |
Thank you so much for the elaborate answer, this is greatly appreciated. We are happy for this to be closed if you think this is by design. We were hoping that we could throttle the notifications in our client code and that this could fix the rate limiting, but we will see that we can clean up the invalid tokens and see if the situation improves. |
I don't see how PushQuery could usefully support the standard I think the broader solution for your specific issue is to look more closely at the batch algorithms in the push adapter and maybe introduce a customizable |
For reference, some additional details about push with query can be found in the original REST documentation, sending pushes to queries. The doc examples mirror the current JS SDK implantation of just using |
New Issue Checklist
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
andskip
for aParseQuery
to loop until all items are iterated on. This is our code:But as it turns out, the
limit
andskip
values from theParseQuery
are ignored byParse.Push.send
, sending it to all installations instead:Parse-SDK-JS/src/Push.js
Lines 54 to 57 in 98674f0
It seems it will only look at the
where
part of theParseQuery
, ignoring the limit and skip. As a result our loop still sends notifications to the entire installation base.Steps to reproduce
Set
limit
andskip
of aParseQuery
used inParse.Push.send
Actual Outcome
limit
andskip
are ignoredExpected Outcome
Only the specified range should receive push notifications.
Environment
Client
4.1.0
The text was updated successfully, but these errors were encountered: