Skip to content

Add support for push scheduling #3717

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

Closed
wants to merge 4 commits into from
Closed

Add support for push scheduling #3717

wants to merge 4 commits into from

Conversation

felipeandradebezerra
Copy link
Contributor

Add a configuration flag on the server to handle the availability of
push scheduling.

Add a configuration flag on the server to handle the availability of
push scheduling.
* @returns {Number|undefined} The push time if it exists in the request
*/
static getPushTime(body = {}) {
var hasPushTime = !!body['push_time'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use body.hasOwnProperty('push_time')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, bad conventions from when I started a year ago

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great!

Can you add the option to the CLI definitions as well?

I know it's a lot but...

@@ -49,6 +50,9 @@ export class PushController {
onPushStatusSaved(pushStatus.objectId);
return badgeUpdate();
}).then(() => {
if (body.push_time) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if body.push_time is set and the config is not enabled for scheduling, we should warn that the message will be delivered right away no? Only skip if configured, what do you think? I'm thinking of all other users :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I've updated the code to only allow skipping on the right configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flovilmart What do you mean about CLI definitions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only skip push sending if scheduling is configured
@codecov
Copy link

codecov bot commented Apr 13, 2017

Codecov Report

Merging #3717 into master will decrease coverage by 0.1%.
The diff coverage is 52.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3717      +/-   ##
==========================================
- Coverage   90.42%   90.31%   -0.11%     
==========================================
  Files         114      114              
  Lines        7412     7432      +20     
==========================================
+ Hits         6702     6712      +10     
- Misses        710      720      +10
Impacted Files Coverage Δ
src/Routers/FeaturesRouter.js 100% <ø> (ø) ⬆️
src/cli/definitions/parse-server.js 50% <ø> (ø) ⬆️
src/Config.js 95.52% <100%> (+0.03%) ⬆️
src/ParseServer.js 90.25% <100%> (+0.06%) ⬆️
src/StatusHandler.js 99% <100%> (+0.02%) ⬆️
src/Controllers/PushController.js 81.53% <41.17%> (-14.38%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.17% <0%> (-0.56%) ⬇️
src/Controllers/SchemaController.js 96.99% <0%> (-0.26%) ⬇️
src/Adapters/Auth/google.js 88.46% <0%> (+19.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 302a0dd...919cfc6. Read the comment docs.

@felipeandradebezerra
Copy link
Contributor Author

@flovilmart the code is updated with additional commits :)

* @param {Object} request A request object
* @returns {Number|undefined} The push time if it exists in the request
*/
static getPushTime(body = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a test for that piece?

There is a bit of logic there, even trivial but that would help not introduce any regression.

I could add them on the top of your branch if you don't have much time :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we've to add a test. Any help is appreciated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wish i knew enough to help.. i will check your test to help further in any future contribution. Tks in advance @flovilmart

@flovilmart
Copy link
Contributor

@felipemobile thanks for getting that one started, I just merged #3722

@flovilmart flovilmart closed this Apr 16, 2017
flovilmart pushed a commit that referenced this pull request May 20, 2017
* Fixes #3717

This fixes PR #3717. Sending push with [email protected] returns error
504 GATEWAY_TIMEOUT. This happens when push_time is not set (default).

* Fix lint issues

* Fix in PushController and add tests

Add a test to check push_time format and if it should schedule push
when the parse-server is configured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants