doFetchModBlockedList: don't block ui thread #7674

Merged
jessopb merged 2 commits from background-modBlockedList into master 2022-08-12 23:23:04 +02:00

2 commits

Author SHA1 Message Date
zeppi
31824a49ee yield thread in storeList 2022-08-12 13:50:03 -04:00
infinite-persistence
c1840bafb9 doFetchModBlockedList: don't block ui thread
doFetchModBlockedList is blocking the ui thread.

Duplicate data in `doFetchModBlockedList::blockListsPerChannel` to about 1000. The tab is dead when function hits, about 4s after reload.

- Yield occasionally using the `setTimeout` method.
- Doing a chunk size of 1 for now so we don't have to yield the inner loop as well (seems good enough). This is just based on a relatively large blocklist size.

- Can't do `await` in a callback, so must change the `forEach` to a `for`.
2022-08-11 17:07:12 -04:00