Skip to content
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

Queue tasks #3

Closed
annevk opened this issue Dec 3, 2021 · 10 comments
Closed

Queue tasks #3

annevk opened this issue Dec 3, 2021 · 10 comments
Labels
clarification Standard could be clearer

Comments

@annevk
Copy link
Member

annevk commented Dec 3, 2021

While preparing #1 I noticed that many promises are resolved and rejected from in parallel steps. Instead this has to be done from tasks. https://html.spec.whatwg.org/#queue-a-global-task seems most appropriate here, not entirely sure if this needs a new task source. Perhaps we should have one for storage in general?

@a-sully
Copy link
Collaborator

a-sully commented May 24, 2022

I'm supportive of this!

Seeing as AccessHandles is supposed to be the fastest storage primitive ever exposed to the web, does it makes sense to provide the Access Handles API its own task source? (in addition to one for storage more broadly)

@annevk
Copy link
Member Author

annevk commented May 25, 2022

Yeah, I think that could be reasonable. (Though we should probably sort out the model in #28 first.)

cc @smaug---- @domenic

@a-sully
Copy link
Collaborator

a-sully commented Nov 11, 2022

Revisiting this... All methods on the SyncAccessHandle are now sync (as per #7), so the argument made in my above comment about wanting a separate task source for this API is somewhat less relevant (although we'd like to eventually support an async version of SyncAccessHandles which is similarly performant - see #41).

It seems like we should have a new task source. @annevk do you have a preference for whether it's for this API or for storage in general?

@annevk
Copy link
Member Author

annevk commented Nov 12, 2022

I think ideally we consider which tasks need to happen in order across storage specifications and which can go out-of-order. And then put those in separate sources?

@a-sully
Copy link
Collaborator

a-sully commented Jan 5, 2023

Hmm good point. Thinking about this a bit more.... Writes using any storage API (including this one) can be rejected if the site is out of quota. So do all storage APIs need to use same task source for writes, since they all interact with the Quota Management API?

There are a couple of other [1, 2] storage-related task sources that I'm aware of, but they both queue operations that are read-only (i.e. don't affect quota)

@annevk
Copy link
Member Author

annevk commented Jan 6, 2023

That's a good point too.

So, the tasks are for informing the event loop about the result of a storage operation. So yes, write storage operations need to be in order (at least per site), but reporting whether that succeeded or not back to JavaScript (this involves tasks) doesn't necessarily have to be in the same order, but we might as well stick to a single task source for that I think.

@a-sully
Copy link
Collaborator

a-sully commented Jan 6, 2023

I was about to file an issue in whatwg/storage but stumbled upon whatwg/storage#89. I don't personally understand much of the discussion happening on that issue - is there more to it than defining a new task source for write operations in the storage spec and then pointing all the storage API specs, including this one, to it?

@annevk
Copy link
Member Author

annevk commented Jan 9, 2023

It's better now that we have "queue a global task". We should probably define a wrapper around that called "queue a storage task" as well as the "storage task source" in the Storage Standard. Would you be willing to take that on?

@a-sully
Copy link
Collaborator

a-sully commented Jan 10, 2023

Filed whatwg/storage#155 (which is erroring on something which doesn't seem to be my fault... :) )

annevk added a commit to whatwg/storage that referenced this issue Jan 16, 2023
Also make use of them internally. Additionally cross-reference more and adopt modern practices.

Helps with whatwg/fs#3. Fixes #89.

Co-authored-by: Anne van Kesteren <[email protected]>
aarongable pushed a commit to chromium/chromium that referenced this issue Feb 6, 2023
The new task source was recently specified here:
https://storage.spec.whatwg.org/#storage-task-source

Prompted by discussion specifically about FSA here:
whatwg/fs#3

Bug: 1412596
Change-Id: I83639555a6f0ad886556ecfe82e96cd90a10993e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4220277
Code-Coverage: Findit <[email protected]>
Reviewed-by: Daseul Lee <[email protected]>
Commit-Queue: Austin Sullivan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1101850}
@a-sully
Copy link
Collaborator

a-sully commented Jun 22, 2023

This was addressed in #95. All promises are now rejected/resolved on the new storage task source (in this spec, at least. See WICG/file-system-access#420)

@a-sully a-sully closed this as completed Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

2 participants