@datacamp/learn-vm-scripts 0.0.3-rc.4 → 0.0.3-rc.6

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/index.cjs +27 -1
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -95399,10 +95399,34 @@ async function loginToDatabricks({
95399
95399
  // src/resetChrome.ts
95400
95400
  var import_node_child_process = require("node:child_process");
95401
95401
  var import_promises3 = require("node:fs/promises");
95402
+ var retryWithExponentialBackoff = async ({
95403
+ fn,
95404
+ maxRetries,
95405
+ initialDelay
95406
+ }) => {
95407
+ let retries = 0;
95408
+ while (retries < maxRetries) {
95409
+ try {
95410
+ await fn();
95411
+ return;
95412
+ } catch (e) {
95413
+ console.error(`Error in exponential backoff iteration ${retries}:`, e);
95414
+ await new Promise(
95415
+ (resolve5) => setTimeout(resolve5, 2 ** retries * initialDelay)
95416
+ );
95417
+ retries++;
95418
+ }
95419
+ }
95420
+ throw new Error("Max retries exceeded");
95421
+ };
95402
95422
  var resetChrome = async ({ userDataDir }) => {
95403
95423
  const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
95404
95424
  console.log("Result from killing chrome.exe:", stdout.toString());
95405
- await (0, import_promises3.rm)(userDataDir, { recursive: true, force: true });
95425
+ await retryWithExponentialBackoff({
95426
+ fn: () => (0, import_promises3.rm)(userDataDir, { recursive: true, force: true }),
95427
+ initialDelay: 100,
95428
+ maxRetries: 10
95429
+ });
95406
95430
  };
95407
95431
 
95408
95432
  // src/startInputWatcher.ts
@@ -95483,6 +95507,8 @@ var startInputWatcher = async ({
95483
95507
  }
95484
95508
  if (lastInput != null && newInput === lastInput) {
95485
95509
  console.log("Input already processed");
95510
+ console.log("Resetting Chrome anyway as a test");
95511
+ await resetChrome({ userDataDir });
95486
95512
  await outputFileHandle.appendFile(`Done: ${newInput}`);
95487
95513
  return;
95488
95514
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacamp/learn-vm-scripts",
3
- "version": "0.0.3-rc.4",
3
+ "version": "0.0.3-rc.6",
4
4
  "repository": "git@github.com:datacamp-engineering/learn-vm-scripts.git",
5
5
  "description": "Scripts used by VMs in learn.",
6
6
  "main": "./dist/index.cjs",