-
Notifications
You must be signed in to change notification settings - Fork 20
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
Use "queue a global task" and supply the correct arguments #101
Comments
Thanks for reviewing the spec! Closing with #103 |
Re-opening this issue for further advice on queuing. As we’re polishing the spec, we realized that using “queuing a storage task” might leave us needing to coordinate with other storage APIs that use the same task source. Since “Queue” implies FIFO, we don’t think guaranteeing all async requests in the same order they’re made is right in all scenarios (and certainly not across different storage APIs). With this,
Curious to learn in which cases it might be correct to just "queue a task". Thanks! |
I think as long as "queue a storage task" is invoked from a general hand-waving "in parallel" that itself doesn't have an associated queue that enforces ordering constraints, then everything may be fine[1]. The problem right now is that, for example, both the algorithm for keys() and persisted() never go "in parallel", so these implicitly must be strictly ordered. The algorithm for open() has a somewhat more dramatic problem as, since the algorithm never goes parallel and it synchronously returns an already-resolved promise, it wouldn't surprise me if it's a requirement that a handler immediately chained on the promise before the task ends would be required to have the storage bucket already available when the microtask queue is processed and before running any additional tasks. 1: That said, the spec text for storage task source is:
And storage endpoint is a little fuzzy but seems to explicitly correspond to a given bottle:
So it's not clear the storage task source works as defined since the storage shelf is really where the Storage Buckets API sits. It could make sense to define a specific task source for shelves if the storage spec also wants to define something like ServiceWorker's job queue mechanism to provide a strict ordering of operations related to buckets. This could be helpful for things like testing bucket limit enforcement since that lack of a queue would mean that one could never have more than one outstanding open() request at a time because there are no ordering constraints. Having an explicit queue that then references a specific task queue could provide expectations about the sequencing which could be a reasonable implementation constraint. That said, we'd want to be judicious in terms of what would want to use the queue. For example, I don't think we would ever want quota tracking to use the job queue, as I think it would be important to leave browsers a lot of implementation flexibility there. Things that might use the queue might also invoke "in parallel" in a way that relaxes ordering constraints again. |
Thanks for your comment @asutherland!
Oh interesting, I guess this relaxes the ordering concerns a bit.
Thanks for pointing this out 😅, I'll go over them and try to fix these.
Good point...seems the In the interim, does it sound reasonable to create our own task source for storage buckets for the spec draft? |
I think there's an advantage to creating our own specific task source than using something more generic like the DOM manipulation task source because we avoid accidentally specifying an ordering that we don't intend or making people think there's some ordering intended. I think for naming, the issues for confusion we need to deal with are:
So for names:
|
Or maybe use "queue a storage task" as defined in the Storage Standard.
Just "queue a task" without task source or global is not correct a lot of the time.
The text was updated successfully, but these errors were encountered: