Skip to content

Commit

Permalink
deps: updated to 4.0.0 of @matrixai/async-locks and switched to usi…
Browse files Browse the repository at this point in the history
…ng `ContextTimedInput`
  • Loading branch information
CMCDragonkai committed Jun 25, 2023
1 parent f95e47b commit daf7f4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 65 deletions.
68 changes: 9 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"node-forge": "^1.3.1",
"node-gyp": "9.0.0",
"prettier": "^2.6.2",
"shx": "^0.3.4",
"semver": "^7.3.7",
"shx": "^0.3.4",
"systeminformation": "^5.12.1",
"ts-jest": "^28.0.5",
"ts-node": "^10.9.1",
Expand Down
10 changes: 5 additions & 5 deletions tests/DBTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ describe(DBTransaction.name, () => {
);
await db.withTransactionF(async (tran2) => {
await tran2.lock(['foo', 'read']);
await expect(tran2.lock(['bar', 'write', 0])).rejects.toThrow(
await expect(tran2.lock(['bar', 'write', { timer: 0 }])).rejects.toThrow(
locksErrors.ErrorAsyncLocksTimeout,
);
expect(tran1.locks.size).toBe(2);
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe(DBTransaction.name, () => {
// This is a noop, because `tran1` owns `key1` and `key2`
await tran2.unlock('key1', 'key2');
// This fails because `key1` is still locked by `tran1`
await expect(tran2.lock(['key1', 'write', 0])).rejects.toThrow(
await expect(tran2.lock(['key1', 'write', { timer: 0 }])).rejects.toThrow(
locksErrors.ErrorAsyncLocksTimeout,
);
await tran1.unlock('key1');
Expand All @@ -1109,7 +1109,7 @@ describe(DBTransaction.name, () => {
await tran1.unlock('key1');
expect(tran2.locks.has('key1')).toBe(true);
expect(tran1.locks.has('key1')).toBe(false);
await expect(tran1.lock(['key1', 'write', 0])).rejects.toThrow(
await expect(tran1.lock(['key1', 'write', { timer: 0 }])).rejects.toThrow(
locksErrors.ErrorAsyncLocksTimeout,
);
});
Expand All @@ -1126,8 +1126,8 @@ describe(DBTransaction.name, () => {
// Currently a deadlock can happen, and the only way to avoid is to use timeouts
// In the future, we want to have `DBTransaction` detect deadlocks
// and automatically give us `ErrorDBTransactionDeadlock` exception
const p1 = tran1.lock(['bar', 'write', 50]);
const p2 = tran2.lock(['foo', 'write', 50]);
const p1 = tran1.lock(['bar', 'write', { timer: 50 }]);
const p2 = tran2.lock(['foo', 'write', { timer: 50 }]);
const results = await Promise.allSettled([p1, p2]);
expect(
results.every(
Expand Down

0 comments on commit daf7f4a

Please sign in to comment.