extension-install 4.4.1 → 4.4.2-canary.487.93cd555

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.
Files changed (2) hide show
  1. package/dist/module.cjs +9 -3
  2. package/package.json +1 -1
package/dist/module.cjs CHANGED
@@ -443,15 +443,21 @@ function removeStaleLock(lockDir, seams) {
443
443
  });
444
444
  return true;
445
445
  }
446
- const MID_REMOVAL_ATTEMPTS = 20;
446
+ const MID_REMOVAL_WAIT_MS = 500;
447
+ const MID_REMOVAL_STEP_MS = 5;
448
+ function pause(ms) {
449
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
450
+ }
447
451
  function makeLockDir(lockDir) {
448
- for(let attempt = 1;; attempt++)try {
452
+ const giveUpAt = Date.now() + MID_REMOVAL_WAIT_MS;
453
+ for(;;)try {
449
454
  external_node_fs_default().mkdirSync(lockDir);
450
455
  return;
451
456
  } catch (error) {
452
457
  const code = error.code;
453
458
  const midRemoval = 'EPERM' === code && !external_node_fs_default().existsSync(lockDir);
454
- if (!midRemoval || attempt >= MID_REMOVAL_ATTEMPTS) throw error;
459
+ if (!midRemoval || Date.now() >= giveUpAt) throw error;
460
+ pause(MID_REMOVAL_STEP_MS);
455
461
  }
456
462
  }
457
463
  function take(lockDir, timeoutMs, seams) {
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "name": "extension-install",
25
- "version": "4.4.1",
25
+ "version": "4.4.2-canary.487.93cd555",
26
26
  "description": "Managed browser installer/uninstaller for Extension.js",
27
27
  "author": {
28
28
  "name": "Cezar Augusto",