@@ -1035,9 +1035,9 @@ describe(DBTransaction.name, () => {
1035
1035
) ;
1036
1036
await db . withTransactionF ( async ( tran2 ) => {
1037
1037
await tran2 . lock ( [ 'foo' , 'read' ] ) ;
1038
- await expect ( tran2 . lock ( [ 'bar' , 'write' , 0 ] ) ) . rejects . toThrow (
1039
- locksErrors . ErrorAsyncLocksTimeout ,
1040
- ) ;
1038
+ await expect (
1039
+ tran2 . lock ( [ 'bar' , 'write' , { timer : 0 } ] ) ,
1040
+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
1041
1041
expect ( tran1 . locks . size ) . toBe ( 2 ) ;
1042
1042
expect ( tran1 . locks . has ( 'foo' ) ) . toBe ( true ) ;
1043
1043
expect ( tran1 . locks . get ( 'foo' ) ! . type ) . toBe ( 'read' ) ;
@@ -1097,9 +1097,9 @@ describe(DBTransaction.name, () => {
1097
1097
// This is a noop, because `tran1` owns `key1` and `key2`
1098
1098
await tran2 . unlock ( 'key1' , 'key2' ) ;
1099
1099
// This fails because `key1` is still locked by `tran1`
1100
- await expect ( tran2 . lock ( [ 'key1' , 'write' , 0 ] ) ) . rejects . toThrow (
1101
- locksErrors . ErrorAsyncLocksTimeout ,
1102
- ) ;
1100
+ await expect (
1101
+ tran2 . lock ( [ 'key1' , 'write' , { timer : 0 } ] ) ,
1102
+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
1103
1103
await tran1 . unlock ( 'key1' ) ;
1104
1104
expect ( tran1 . locks . size ) . toBe ( 1 ) ;
1105
1105
// This succeeds because `key1` is now unlocked
@@ -1109,9 +1109,9 @@ describe(DBTransaction.name, () => {
1109
1109
await tran1 . unlock ( 'key1' ) ;
1110
1110
expect ( tran2 . locks . has ( 'key1' ) ) . toBe ( true ) ;
1111
1111
expect ( tran1 . locks . has ( 'key1' ) ) . toBe ( false ) ;
1112
- await expect ( tran1 . lock ( [ 'key1' , 'write' , 0 ] ) ) . rejects . toThrow (
1113
- locksErrors . ErrorAsyncLocksTimeout ,
1114
- ) ;
1112
+ await expect (
1113
+ tran1 . lock ( [ 'key1' , 'write' , { timer : 0 } ] ) ,
1114
+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
1115
1115
} ) ;
1116
1116
await tran1 . lock ( 'key1' ) ;
1117
1117
expect ( tran1 . locks . has ( 'key1' ) ) . toBe ( true ) ;
@@ -1126,8 +1126,8 @@ describe(DBTransaction.name, () => {
1126
1126
// Currently a deadlock can happen, and the only way to avoid is to use timeouts
1127
1127
// In the future, we want to have `DBTransaction` detect deadlocks
1128
1128
// 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 } ] ) ;
1131
1131
const results = await Promise . allSettled ( [ p1 , p2 ] ) ;
1132
1132
expect (
1133
1133
results . every (
0 commit comments