@componentor/fs 2.0.9 → 2.0.11

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.js CHANGED
@@ -946,23 +946,19 @@ async function handleMessage(msg) {
946
946
  }
947
947
  }
948
948
 
949
- // Process queued messages with concurrency limit
950
- // Allows multiple operations to run in parallel but prevents overwhelming the worker
951
- const MAX_CONCURRENT = 8;
952
- let activeOperations = 0;
953
-
954
- async function processQueue() {
955
- while (messageQueue.length > 0 && activeOperations < MAX_CONCURRENT) {
949
+ // Process queued messages after ready
950
+ function processQueue() {
951
+ while (messageQueue.length > 0) {
956
952
  const msg = messageQueue.shift();
957
- activeOperations++;
958
- handleMessage(msg).finally(() => {
959
- activeOperations--;
960
- processQueue(); // Process next queued message
961
- });
953
+ handleMessage(msg); // Process concurrently - don't wait
962
954
  }
963
955
  }
964
956
 
965
- // Queue messages and process with controlled concurrency
957
+ // Handle messages concurrently - each operation proceeds independently
958
+ // This is better than a queue with concurrency limit because:
959
+ // 1. If one operation hangs, others can still complete
960
+ // 2. Small files don't get blocked behind large files
961
+ // 3. The Web Locks API already handles per-file serialization
966
962
  self.onmessage = (event) => {
967
963
  messageQueue.push(event.data);
968
964
  if (isReady) {