in src/TransactionLockHelper.ts [160:202]
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) {
for (const storeName of trans.token.storeNames) {
this._exclusiveLocks[storeName] = true;
}
} else {
for (const storeName of trans.token.storeNames) {
this._readOnlyCounts[storeName]++;
}
}
trans.openDefer.resolve(trans.token);
}
this._checkClose();
}