Sperren: Timeout eines Wartenden hebt die Sperre nicht auf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
679f996597
commit
ea71b3f1c3
2 files changed
+52
-15
No files matched your search
@@ -37,3 +37,15 @@ test('Fehler geben die Sperre frei', async () => {
|
||||
await assert.rejects(withLocks(['a'], async () => { throw new Error('x') }))
|
||||
assert.equal(await withLocks(['a'], async () => 42), 42)
|
||||
})
|
||||
test('Timeout eines Wartenden hebt die Sperre nicht auf', async () => {
|
||||
const call3 = (async () => {
|
||||
await sleep(100)
|
||||
await withLocks(['a'], job('3', 10))
|
||||
})()
|
||||
await Promise.all([
|
||||
withLocks(['a'], job('1', 300)),
|
||||
withLocks(['a'], job('2', 10), { waitMs: 50 }),
|
||||
call3,
|
||||
])
|
||||
assert.ok(log.indexOf('3:start') > log.indexOf('1:end'), `log: ${log.join(',')}`)
|
||||
})
|
||||
Reference in new issue
Block a user