@componentor/fs 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -950,23 +950,19 @@ async function handleMessage(msg) {
950
950
  }
951
951
  }
952
952
 
953
- // Process queued messages with concurrency limit
954
- // Allows multiple operations to run in parallel but prevents overwhelming the worker
955
- const MAX_CONCURRENT = 8;
956
- let activeOperations = 0;
957
-
958
- async function processQueue() {
959
- while (messageQueue.length > 0 && activeOperations < MAX_CONCURRENT) {
953
+ // Process queued messages after ready
954
+ function processQueue() {
955
+ while (messageQueue.length > 0) {
960
956
  const msg = messageQueue.shift();
961
- activeOperations++;
962
- handleMessage(msg).finally(() => {
963
- activeOperations--;
964
- processQueue(); // Process next queued message
965
- });
957
+ handleMessage(msg); // Process concurrently - don't wait
966
958
  }
967
959
  }
968
960
 
969
- // Queue messages and process with controlled concurrency
961
+ // Handle messages concurrently - each operation proceeds independently
962
+ // This is better than a queue with concurrency limit because:
963
+ // 1. If one operation hangs, others can still complete
964
+ // 2. Small files don't get blocked behind large files
965
+ // 3. The Web Locks API already handles per-file serialization
970
966
  self.onmessage = (event) => {
971
967
  messageQueue.push(event.data);
972
968
  if (isReady) {