-
Notifications
You must be signed in to change notification settings - Fork 65
Wait loop questions #436
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
Comments
During the firing the version change event (10.5), script may make additional requests. These would keep the transaction alive, so going inactive at 10.6 would not cause the transaction to auto-commit. So waiting for the transaction to finish in step 11 is intentional. In the case where no requests are made (e.g. your code example), the relevant prose is in the transaction lifetime definition: "The implementation must attempt to commit a transaction when all requests placed against the transaction have completed and their returned results handled, no new requests have been placed against the transaction, and the transaction has not been aborted" The intention is that once we reach a state where all existing requests are completed and new requests can be made, the transaction should attempt to commit. The statement could be made more explicit e.g. by stating "The implementation must attempt to commit a transaction when it is inactive, all requests..." Making the whole transaction lifecycle more algorithmic would also be nice. :) |
@inexorabletash 10.5 can set the state to finished (by aborting) as in the example below. Are we now stuck in an infinite loop at step 11?
|
Yep. We should add a step after step 10.5 that's basically "If transaction's state is active, then run these steps:" and make the subsequent steps substeps of this. I believe that will handle calling either abort() or commit() during the dispatch, similar to https://w3c.github.io/IndexedDB/#fire-a-success-event |
* Clarify that only inactive transactions should auto-commit. * Fix upgrade steps to correctly handle aborted transactions. Resolves #436
* Clarify that only inactive transactions should auto-commit. * Fix upgrade steps to correctly handle aborted transactions. Resolves #436
Re-opening, as it would still be nice to have more explicit lifecycle steps for transactions. |
In Upgrading a database step 11 is supposed to wait for the transaction to finish.
A transaction is finished once it enters the
finished
state (aftercommit
orabort
)Calling
indexedDB.open("test", 1)
will cause an upgrade, and then step 10.5 could change the state (via autocommit, or user action), but then we instantly set it back to inactive in step 10.6Given the following snippet:
Once we get to close a database connection step 3. we will be stuck in an infinite loop, because at no point has the transaction gone to the finished state. (The
onupgradeneeded
callback does nothing that would cause an abort or commit)The text was updated successfully, but these errors were encountered: