-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[new package] autoupdate-polling #11034
Conversation
…update: autoupdate-polling.
…t would be great to find a way of making autoupdate less expensive".
… better not to commit with this topic right now.
Great PR :) 3 seconds though seems a bit too aggressive imho, specially for apps serving a lot of users at the same time. In my personal experience, I have no app that break if the interval was higher. Having the possibility to config / customize this would be the cherry top of the cake ;) |
Thank you for the incentive @Fen747. I wrote it to give the developer a comfortable option so he wouldn't need to manually refresh the pages while under development. So the 3 seconds were chosen to address this use case, more than that could make the dev hit the refresh button anyway or slow down development. In fact, the whole package only works if I'll think about it. |
…eping a default value of 3s for development
@Fen747 just to let you know that it's done 😄. The dev will be able to change the polling frequency by setting a public Meteor.setting. |
}, delay); | ||
}; | ||
|
||
if (!Meteor.isProduction || Meteor.settings.public.autoupdate_polling_time) |
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.
Better to use Meteor.settings.public?.autoupdate_polling_time
to prevent errors when public settings is not set.
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.
I think this won't be necessary because Meteor.settings.public
is guaranteed to always be defined according to the docs, even if there are no settings specified.
@@ -14,3 +14,4 @@ typescript # Enable TypeScript syntax in .ts and .tsx modules | |||
shell-server # Server-side component of the `meteor shell` command | |||
webapp # Serves a Meteor app over HTTP | |||
server-render # Support for server-side rendering | |||
autoupdate-polling # Provides a lightweight hot code push functionality |
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.
Should this really be in the minimal skeleton?
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.
Tough one. On one hand HCP functionality is not strictly necessary to write an app, on the other hand HCP is an important part of the Meteor developer experience that up until now the minimal skeleton was missing off due to the size of the original autoupdate
package.
I think it should be included in the minimal skeleton but I wouldn't mind leaving it off if you think it would be better.
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.
is it acceptable as minimal to not have updates? I don't think so. So I vote to include it.
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.
Great work! I'm just suggesting a small adjustment.
}, delay); | ||
}; | ||
|
||
if (!Meteor.isProduction || Meteor.settings.public.autoupdate_polling_time) |
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.
@delki8 I'm following a new pattern here, always defining package options on packages key.
Meteor.settings.public.packages['autoupdate-polling'].pollingInterval
can you change to follow this pattern?
see here one example https://docs.meteor.com/api/collections.html#mongo_connection_options_settings
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.
Sure. It's done 😄
@@ -14,3 +14,4 @@ typescript # Enable TypeScript syntax in .ts and .tsx modules | |||
shell-server # Server-side component of the `meteor shell` command | |||
webapp # Serves a Meteor app over HTTP | |||
server-render # Support for server-side rendering | |||
autoupdate-polling # Provides a lightweight hot code push functionality |
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.
is it acceptable as minimal to not have updates? I don't think so. So I vote to include it.
Thanks for creating this PR, @delki8. The current As mentioned in #11034 (comment), a good polling interval depends on several factors: development vs. production, patience of the developer, type of application, etc., so the setting probably needs to be adjusted depending on the environment (for example, the three second interval would be too short if the application doesn't need to be reactive in production). However, Meteor has always strived to be a zero-configuration tool and I think it would be great if we could find a solution that follows this principle and covers more use cases (and personal preferences) without the need for configurability. Additionally, polling spams the network tab in browser development tools, which makes finding and debugging other requests more difficult. One possible solution is to use SSE (server-sent events) instead of polling. SSE are supported by all major browsers and allow one-way communication from the server to the client. I've worked quite a bit on auto-reloading in #10505 (experimental error page reloads based on SSE), meteor/meteor-feature-requests#354 (concept for integrating reloading more deeply into the Meteor Tool), and My experiments were for development only, so they wouldn't work for reloads in production without making some changes. However, it looks like development reloads were your main concern when you initially created this PR. Maybe we can combine some of these ideas here. What do you think? 🙂 Some additional points:
|
Hello @klaussner. Thank you so much for the input and don't worry about how it sounds. I appreciate your discerning review and hope to address each of your concerns in my answer so we can continue talking about it.
Did I forget anything? Anyway, thank you again for the comment :) |
Thank you for the detailed response! 🙂
I agree that three seconds are a good trade-off and will probably work for many use cases. However, one of my favorite Meteor features is that it makes configuration not only optional but unnecessary/impossible in many cases. One example of this is code splitting, which often requires some configuration or tweaks in other build tools to make sure that modules aren't downloaded multiple times. In Meteor it just works out of the box and can't even be configured, and in most cases I prefer solutions like that.
Agreed! The development experience with the minimal template isn't great at the moment and should be improved soon. I'll try to find some time on the weekend or next week to look into it.
Sorry, my comment was a little vague. What I meant was that the server/build tool doesn't support client-only refreshes with |
Hi, as we are not having many discussions around this PR I'm closing it. Of course, if we have new ideas we can re-open it. No problem. |
why
I created this package to address this part of the roadmap:
package README
autoupdate-polling
is based on the popularautoupdate
.The goal is to provide a lightweight alternative that replaces the use of
ddp
by a polling mechanism that checks the server for a new version every 3 seconds. When it sees that a new version is available, it uses thereload
package to gracefully save the app's state and reload it in place.To make it work, while under development the server exposes a public endpoint that expects the client's archetype and returns the most recent build of the app's client.
production client bundle size for a --minimal meteor app
vanilla --minimal
with autoupdate
with autoupdate-polling
caveats:
autoupdate
don't have any tests I decided to not write any new tests forautoupdate-polling