Comments (5)
I am travelling now for a few days, I get back to you after.
from music-metadata-browser.
await Promise.allSettled(files.map(async (file) => { return Metadata.parseBlob(file) }))
Better to limit the number of parallel calls. You may use something like p-limit.
addEventListener('message', async (event) => { const id = event.data.id as number const file = event.data.file as File parse(id, file) })
Looks like the promise returned by parse is ignored.
const queue = [] let queuePromise = Promise.resolve() addEventListener('message', async (event) => { const id = event.data.id as number const file = event.data.file as File queue.push(() => parse(id, file)) queuePromise = queuePromise.then(() => queue.shift()()) })
I fail to see the point this mechanism
from music-metadata-browser.
Better to limit the number of parallel calls. You may use something like p-limit.
That is a good idea, thanks. I will probably use it.
Looks like the promise returned by parse is ignored.
Awaiting this call would change nothing actually. Everything is handled inside the parse
function. I will create a minimal reproduction repository tomorrow, so you could better understand the issue.
I fail to see the point this mechanism
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 parseBlob
when in Firefox's Web Worker
from music-metadata-browser.
@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.
from music-metadata-browser.
This mechanism simply queues the parsing of each file so that only one file is parsed at once.
Smart, understood.
from music-metadata-browser.
Related Issues (20)
- Uncaught ReferenceError: `Buffer` is not defined HOT 7
- Get rid of assert dependency
- Bug with in-browser implementation HOT 6
- Uncaught ReferenceError: exports is not defined HOT 2
- 2.5.0 Version updates Break Some Features on Safari HOT 5
- 'TypeError: this.parseReadableStream is not a function' on latest version 2.5.1 HOT 2
- Broken data in metadata result HOT 3
- Incompatibility with Webpack 5 HOT 3
- TypeError: can't access property "call", Stream is undefined HOT 9
- No title or artist metadata from URL streams HOT 4
- Add MusicSource to online demos HOT 1
- fetchFromUrl doesn't include credentials HOT 1
- Can't use this package with vite 3 HOT 9
- Source map warnings.
- Using music-metadata 7.x instead on 8.x HOT 2
- use Range header to fetch metadata instead of whole file? HOT 1
- Nuxt 3 compatibility HOT 2
- Wrong "Sample-rate" in "Audio Tag Analyzer" demo
- Option to avoid parsing entire file? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from music-metadata-browser.