-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple blobs at once not parsing in WebWorker in Firefox #948
Comments
Better to limit the number of parallel calls. You may use something like p-limit.
Looks like the promise returned by parse is ignored.
I fail to see the point this mechanism |
That is a good idea, thanks. I will probably use it.
Awaiting this call would change nothing actually. Everything is handled inside the
This mechanism simply queues the parsing of each file so that only one file is parsed at once. Edit: After some more testing, it seems that even when I run the parsing sequentially, it can just hang without ever resolving or rejecting |
@Borewit, here I created a minimal reproduction: https://stackblitz.com/edit/vitejs-vite-mrd4bk?file=src%2Fmain.ts,src%2Fworker.ts&terminal=dev From my testing, sometimes it gets stuck on parsing blob even if I send a single file while using Firefox 120. It works well in Chromium and in Firefox but outside Web Worker. |
Smart, understood. |
I am travelling now for a few days, I get back to you after. |
I've decided to move the parsing logic to the web worker, so that the main thread and ui wouldn't be impacted by analyzing lots of files.
Consider following web worker code:
Now, when I try to parse it the easiest way possible, only a few random files are parsed:
In that case, only files with id 3 and 4 have been parsed. Note that pausing, the web worker thread in the devtools does nothing until I send a new file to process to the worker. It then breaks on the
addEventListener
. TheparseBlob
never resolves nor rejects.Also, before moving all the logic into the web worker I could start parsing all files at the same time without any problems like so:
The workaround that I need to introduce now is to wait until one file is parsed and then start parsing the next one. That's not really what I want to do as it would be much less performant.
Affected browser: Firefox 120, it works well on Chromium
Vite 4 with the ngmi-polyfill plugin as per #836 (comment)
The text was updated successfully, but these errors were encountered: