Skip to content

Commit bea669d

Browse files
committed
deps: updated to 4.0.0 of @matrixai/async-locks and switched to using ContextTimedInput
1 parent c80ada6 commit bea669d

File tree

3 files changed

+15
-65
lines changed

3 files changed

+15
-65
lines changed

package-lock.json

+9-59
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"node-forge": "^1.3.1",
5959
"node-gyp": "9.0.0",
6060
"prettier": "^2.6.2",
61-
"shx": "^0.3.4",
6261
"semver": "^7.3.7",
62+
"shx": "^0.3.4",
6363
"systeminformation": "^5.12.1",
6464
"ts-jest": "^28.0.5",
6565
"ts-node": "^10.9.1",

tests/DBTransaction.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ describe(DBTransaction.name, () => {
10351035
);
10361036
await db.withTransactionF(async (tran2) => {
10371037
await tran2.lock(['foo', 'read']);
1038-
await expect(tran2.lock(['bar', 'write', 0])).rejects.toThrow(
1038+
await expect(tran2.lock(['bar', 'write', { timer: 0 }])).rejects.toThrow(
10391039
locksErrors.ErrorAsyncLocksTimeout,
10401040
);
10411041
expect(tran1.locks.size).toBe(2);
@@ -1097,7 +1097,7 @@ describe(DBTransaction.name, () => {
10971097
// This is a noop, because `tran1` owns `key1` and `key2`
10981098
await tran2.unlock('key1', 'key2');
10991099
// This fails because `key1` is still locked by `tran1`
1100-
await expect(tran2.lock(['key1', 'write', 0])).rejects.toThrow(
1100+
await expect(tran2.lock(['key1', 'write', { timer: 0 }])).rejects.toThrow(
11011101
locksErrors.ErrorAsyncLocksTimeout,
11021102
);
11031103
await tran1.unlock('key1');
@@ -1109,7 +1109,7 @@ describe(DBTransaction.name, () => {
11091109
await tran1.unlock('key1');
11101110
expect(tran2.locks.has('key1')).toBe(true);
11111111
expect(tran1.locks.has('key1')).toBe(false);
1112-
await expect(tran1.lock(['key1', 'write', 0])).rejects.toThrow(
1112+
await expect(tran1.lock(['key1', 'write', { timer: 0 }])).rejects.toThrow(
11131113
locksErrors.ErrorAsyncLocksTimeout,
11141114
);
11151115
});
@@ -1126,8 +1126,8 @@ describe(DBTransaction.name, () => {
11261126
// Currently a deadlock can happen, and the only way to avoid is to use timeouts
11271127
// In the future, we want to have `DBTransaction` detect deadlocks
11281128
// and automatically give us `ErrorDBTransactionDeadlock` exception
1129-
const p1 = tran1.lock(['bar', 'write', 50]);
1130-
const p2 = tran2.lock(['foo', 'write', 50]);
1129+
const p1 = tran1.lock(['bar', 'write', { timer: 50 }]);
1130+
const p2 = tran2.lock(['foo', 'write', { timer: 50 }]);
11311131
const results = await Promise.allSettled([p1, p2]);
11321132
expect(
11331133
results.every(

0 commit comments

Comments
 (0)