-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor: set maxIdlePreloads to be constant over time #7846
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
base: main
Are you sure you want to change the base?
refactor: set maxIdlePreloads to be constant over time #7846
Conversation
🦋 Changeset detectedLatest commit: cc50897 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
125cd04
to
5e8d71c
Compare
commit: |
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 don't like this change: When a new preload request comes in, and it is higher priority than what is in the queue, it and its dependencies will have to wait until less urgent preloads are done.
By making the parallel amount depend on the probability, we have headroom for more urgent preloads.
Is that wrong?
Ok fair enough, simpler code and it you see it improve things, so good. Could you fix the conflict? |
5e8d71c
to
cc50897
Compare
cc50897
to
0e456fb
Compare
@@ -78,10 +78,9 @@ export const trigger = () => { | |||
const inverseProbability = bundle.$inverseProbability$; | |||
const probability = 1 - inverseProbability; | |||
const allowedPreloads = graph | |||
? // The more likely the bundle, the more simultaneous preloads we want to allow | |||
Math.max(1, config.$maxIdlePreloads$ * probability) | |||
? config.$maxIdlePreloads$ | |||
: // While the graph is not available, we limit to 2 preloads |
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.
Can you remove the to 2
🙈
What is it?
Description
It's better to have this value be constant, otherwise it is hard for the developer to control it.
Also increased the ssrPreloads limit (before bundle-graph is loaded) to 5 since 2 seems like it can create a lot of waterfalls no? (I didn't benchmark this ^^)
Checklist
pnpm change