-
Notifications
You must be signed in to change notification settings - Fork 341
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
Consider to add "resolveAtIdleTime" to RequestInit #821
Comments
This seems related to other proposals on that front, most notably priority hints. |
Definitely seems related to PH agreed, though seems to cover a superset of the problems PH is geared toward (given that resolving in idle time could mean delaying resolution due to either network or main thread contention). I think the networking-priority portion of this would be best suited for Priority Hints though. Did you have any specific cases in mind where this might be most helpful? Currently I’m looking for as many network-contention-heavy scenarios as I can where user-supplied priority hints may result in a perceivable win, so I’m open to hearing anything you may have in mind. |
Priority hints is about the networking side. This is more about the stuff discussed TPAC about handling network responses at lower priority. |
Is there a reason we can't define a single API/developer-signal to implement both network priority and response handling? |
Sure we can. As I said in the initial comment, I just filed the issue to record the idea somewhere before I forget. |
I cannot think of a reason to not tackle both the problems (other than scope), makes sense to consider both aspects. However the response handling priority is a bit different: it needs a way to pass a priority (that won't always necessarily be the same as fetch priority), that can potentially be updated (eg. something was fetched preemptively to prepare next screen, but now the user has explicitly requested it or vice versa). Ability to specify priority for fetch promise resolution (and something for xhr) makes sense to me. |
Just having a general function, say waitForIdle, looks simpler to me. We can use it with timeout fairly easily.
This actually executes tiny code when it's not idle, but I think we can bear with it. |
I guess |
See also #436. |
During TPAC there was discussion about having lower priority fetches. The idea was something more complicated, but perhaps we could actually start by just hinting when fetch()'s promise should be resolved.
Idle time could work reasonable well for many cases, though perhaps there would need to be also some max timeout to ensure it gets resolved at some point.
And since XHR is very commonly used, something similar could be added there too.
(Just recording this idea here, so that I don't forget it.)
@spanicker
The text was updated successfully, but these errors were encountered: