-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Adds support for PushScheduling #3722
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
Conversation
Add a configuration flag on the server to handle the availability of push scheduling.
Only skip push sending if scheduling is configured
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. cool.
src/Controllers/PushController.js
Outdated
body['expiration_time'] = PushController.getExpirationTime(body); | ||
body['push_time'] = PushController.getPushTime(body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just below we use body.push_time
notation......
src/StatusHandler.js
Outdated
@@ -110,6 +110,8 @@ export function pushStatusHandler(config, objectId = newObjectId()) { | |||
const handler = statusHandler(PUSH_STATUS_COLLECTION, database); | |||
const setInitial = function(body = {}, where, options = {source: 'rest'}) { | |||
const now = new Date(); | |||
const pushTime = body.push_time || new Date(); | |||
const status = body.push_time ? "scheduled" : "pending"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above we use hasOwnPorperty but not here?
Codecov Report
@@ Coverage Diff @@
## master #3722 +/- ##
==========================================
+ Coverage 90.42% 90.44% +0.02%
==========================================
Files 114 114
Lines 7412 7438 +26
==========================================
+ Hits 6702 6727 +25
- Misses 710 711 +1
Continue to review full report at Codecov.
|
@flovilmart this looks nifty. If this goes in we'll get a potential scheduled status in Additionally, but somewhat unrelated, to your knowledge are there any sdks setup for reading Just airing some thoughts on whether the aforementioned class and the possible |
Those values are inherited from the good old parse.com. You're right, they're not supposed to be consumed from client SDK or even queried for that matter. The _PushStatus entries are protected by masterKey. This state enum should be stable, from scheduled it should move to sending when consumed by the worker. |
Gotcha, good to hear those values are fairly cemented then. Hmmm, we're living on the wild side in php land by offering that feature then... I figured it's relatively acceptable given the capacity to send pushes is available there, makes sense to compliment it with some sort of basic monitoring as an optional feature. Anyways just checking, thanks for the info! |
That makes total sense this feature is available on backend SDK's. That would be a shame it wasn't :) |
@flovilmart what are the prereqs to enable scheduling on Parse-server? I'm a bit confused about this feature since we're not going to rely on timers. Has anyone already started to change the dashboard? |
@felipemobile didn't you started to change the dashboard? For now, the scheduling won't work on parse-server, unless someone polls the _PushStatus table and runs the push sending. We'll figure it out in time, but I believe this will require some kind of distributed cron based schedule. we'll see how it goes, this will also probably enable the jobs. Not sure I want to implement/manage/maintain those schedules, but we'll see. |
So pooling will be the mechanism behind scheduled pushs for now. On the dashboard I have to put some validations and make minor updates based in this pull request. Is App Store reviews still relevant? If so, it will also rely on timers/cronjobs or do you have another suggestion? |
Not sure about AppStore reviews, that's quite a chicken and egg problem. Do we want to maintain and manage a cron-ish scheduler when so many projects do it well... |
Do you plan to release the push scheduled in parse-server version 2.3.9 later this week? |
Probably! |
It's assumed that when push scheduling is available, the dashboard should allow users to choose the delivery time. PS: There is no scheduling mechanism on parse-server, so pooling _PushStatus will be the mechanism behind scheduled pushs for now. More info: parse-community/parse-server#3722
Originally #3717