Skip to content

Commit b9de31a

Browse files
committed
fix(Scanner): yieldToEventLoop less often
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent fb55c67 commit b9de31a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib/Scanner.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,14 @@ export default class Scanner<L1 extends TItemLocation, L2 extends TItemLocation>
253253
allCreatedItems
254254
.sort((a, b) => b.item.count() - a.item.count())
255255

256-
// 2. Match ALL created items (roots + descendants) against removed pool
256+
// Match ALL created items (roots + descendants) against removed pool
257+
let i = 0
257258
for (const createdEntry of allCreatedItems) {
258-
await yieldToEventLoop()
259+
if (i === 100) {
260+
i = 0
261+
await yieldToEventLoop()
262+
}
263+
i++
259264
const { rootAction: createRootAction, item: createdItem } = createdEntry
260265

261266
// Gather potential matches from all signals

0 commit comments

Comments
 (0)