in src/TransactionLockHelper.ts [233:284]
private _checkNextTransactions(): void {
if (
some(this._exclusiveLocks, (lock) => lock) &&
!this._supportsDiscreteTransactions
) {
// In these cases, no more transactions will be possible. Break out early.
return;
}
for (let i = 0; i < this._pendingTransactions.length; ) {
const trans = this._pendingTransactions[i];
if (trans.opened) {
i++;
continue;
}
if (this._closingDefer) {
this._pendingTransactions.splice(i, 1);
trans.openDefer.reject("Closing Provider");
continue;
}
if (
some(
trans.token.storeNames,
(storeName) =>
this._exclusiveLocks[storeName] ||
(trans.token.exclusive && this._readOnlyCounts[storeName] > 0)
)
) {
i++;
continue;
}
trans.opened = true;
if (trans.token.exclusive) {
each(trans.token.storeNames, (storeName) => {
this._exclusiveLocks[storeName] = true;
});
} else {
each(trans.token.storeNames, (storeName) => {
this._readOnlyCounts[storeName]++;
});
}
trans.openDefer.resolve(trans.token);
}
this._checkClose();
}