Skip to content

Commit cdb97a8

Browse files
committed
Try with setImmedaite in waitFOrRequestBlock
1 parent fff493b commit cdb97a8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test/replicate.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1235,11 +1235,7 @@ for (let i = 0; i < 500; i++) {
12351235
const s1 = b.session()
12361236
const s2 = b.session()
12371237

1238-
const cancelling = waitForRequestBlock(s1).then(() => {
1239-
const res = s1.close()
1240-
// console.log('called close on s1')
1241-
return res
1242-
})
1238+
const cancelling = waitForRequestBlock(s1).then(() => res = s1.close())
12431239

12441240
const b1 = s1.get(0)
12451241
const b2 = s2.get(0)
@@ -1510,8 +1506,8 @@ async function waitForRequestBlock (core, opts) {
15101506
while (true) {
15111507
const reqBlock = core.replicator._inflight._requests.find(req => req && req.block)
15121508
if (reqBlock) break
1513-
1514-
await new Promise(resolve => setTimeout(resolve, 1))
1509+
await new Promise((resolve) => setImmediate(resolve))
1510+
// await new Promise(resolve => setTimeout(resolve, 100))
15151511
}
15161512
}
15171513

0 commit comments

Comments
 (0)