Step 11 of getAvailability should not run "in parallel" #381
Comments
|
Agreed. |
|
Note that it looks like "in parallel" was added for Issue #335 filed by @schien, to resolve the Promise early. The issue seems to be:
Practically speaking, I expect that developers will need to add an @schien et al what do you think? |
"In parallel" gives the exact opposite result: it makes the monitoring run in the background and thus the promise gets resolved immediately (before monitoring is complete). Actually, we would not even need a Promise given that all other steps can run synchronously.
A second call to
I note that could affect tests as well, and @tomoyukilabs raised the question of the "initial value" in: I would personally expect that initial value to convey "complete" information, meaning the "same" result as if I had called This is what the test on |
tidoust
referenced
this issue
in w3c/web-platform-tests
Dec 2, 2016
Merged
[presentation-api] Refine getAvailability() test #4257
Correct, but we'll still need a Promise to be able to notify the caller when availability information is known.
Correct, the set of non-empty Availability objects is what requires the user agent to monitor continuously, not additional invocations of getAvailability(). The existing Promise would be settled with the previous result. So we don't need to worry about the re-invocation case.
I agree, and that's what I was proposing in #381 (comment). And dropping "in parallel" achieves that result. It's possible that a second availability object is created with the same set of URLs as an existing PresentationRequest. In that case, we don't need to wait for the monitor steps to complete and can get a result from an existing object. But I think that's an optimization that doesn't need to be spelled out in the spec. Before submitting a PR, I wanted to give @schien a chance to weigh in because he filed an issue that added "in parallel." |
tidoust
added a commit
to tidoust/presentation-api
that referenced
this issue
Dec 14, 2016
|
|
tidoust |
97ee0f6
|
tidoust
referenced
this issue
Dec 14, 2016
Merged
Issue #387: Monitoring algo takes pending request to start into account #392
mfoltzgoogle
added a commit
that referenced
this issue
Dec 21, 2016
|
|
tidoust + mfoltzgoogle |
0c800c5
|
|
Should be addressed by PR #387. |
tidoust commentedDec 1, 2016
•
edited
I failed to notice that when I reviewed the update, but I think "in parallel" is wrong in step 11 of the
getAvailabilityalgorithm which instructs the user agent to "Run the algorithm to monitor the list of available presentation displays in parallel".In practice, if the algorithm is run in parallel, that means the first time an app calls
getAvailability, it will always end up with aPresentationAvailabilityobject whosevalueisfalse(set by step 9.1 since the list of available presentation displays is empty to start with). Is that the intent? I would rather expect thevalueto convey the outcome of running the monitoring algorithm.