-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add Parse Endpoint that "sends all scheduled pushes" #6066
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
Comments
Thank you for your feedback, The problem I see with a CLI is that everyone's current "Jobs" Schedulers interface through the "/jobs" endpoint. so if we did a CLI people couldn't use the existing scheduler they have for "Jobs" for also triggering the sending of pushs. A separate package doesn't make sense because the "pushTime" is baked into parse server and there is only one "correct" way to use it. |
Also, I don't think the cloud function alternative would work at all actually because internal access to "pushController" and "StatusHandler" is needed to sent the existing _PushStatus objects and update them in a uniform way. Plus, using the pushController means the endpoint solution would work for ALL existing push adaptors with no changes needed. |
Take a look in this discussion here and also in this package here. I don't like so much the idea of the api endpoint because it would lead people to create a schedule to hit this endpoint every min (or every second?). That's why I think that it would be better a process that we can run separately (through CLI or separate package - we can use Parse Server as a dependency in the case of the separate package) ideally listening to a queue or at least querying directly in MongoDB. |
@davimacedo thank you for the package, that is a valid way of performing this task. You are correct in assuming that this would lead people to poll the endpoint every minute BUT that is exactly the process we have already been using for the last year to trigger scheduled jobs. I use Kubernetes to manage 30+ instances of Parse Server for a VERY large app. so even at scale polling every minute is a very valid way of using Parse Server. I would like to make a few points though hoping they warrant the consideration of a PR. Using the package you mentioned has the following disadvantages:
|
There is a difference between the scheduled push and the scheduled job. The scheduled job hit the server only when you know that there is some job to be executed while the scheduled push will have to hit the server every minute (or second) just to check if there is something to be sent. So if you don't schedule so many push notifications, you will have to hit the server a lot of times unnecessarily. On the other hand, if you have a large number of scheduled pushes to be sent each time, you may have memory problem with a single container sending all these pushes. Anyway I think that each approach has its advantages/disadvantages and that's why I brought them for discussion. Besides I personally believe that a separate process would be better, I am not against having it in the API as well. So, if you believe that's actually the best way, go for it and send the PR. I will be happy to review. |
Thank you @davimacedo! I’ll try to open a PR for this hopefully in the next week! |
Follow up question, you said we might run into a memory problem with a single container sending lots of pushes, why would a Parse Server instance run into a memory issue and the dedicated pusher not? |
If implemented by listening a queue, we could have many containers listening to it. So instead of a single container sending the pushes, we'd have multiple ones. Anyway, I think we can try to mitigate it even in the API approach. What we will probably need to do in the |
Yup! thats the way I’ve written it, I have 4 test cases so far but I want more coverage before I open the PR |
I have no idea how to cleanly send all of my scheduled push notifications ensuring:
I'm hours into researching how to use parse to send "scheduled Push notifications" and this is what I know.
Describe the solution you'd like
I would like to add a master key protected endpoint, like "/parse/push/sendScheduledPushes" or "/parse/push/sweep", that triggers the sending of all "scheduled Pushes" respecting the scheduling rules so that the scheduler of my choice can just trigger this endpoint on an interval of my choice without having to write a cloud function that requires knowing about all of the details of _PushStatus.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Option B: Would work for me but not for the community
Build out a cloud function that Queries _PushStatus and sends qualifying pushes BUT Since the "scheduling" of pushes is baked into Parse Server I feel like the community would have to dig too deep into the code to understand the details of _PushStatus. whereas it would be simple to trigger the sending of those pushes with just a POST to the proposed Parse Server endpoint.
Additional context
Add any other context or screenshots about the feature request here.
I'm happy to open a PR if this is something that would be considered, I would just need some help with understanding the rules of scheduling _PushStatus.
The text was updated successfully, but these errors were encountered: