@wix/ditto-codegen-public 1.0.514 → 1.0.515

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/out.js +19 -6
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -129761,12 +129761,13 @@ var require_fetch_scheduler = __commonJS({
129761
129761
  "dist/jobs/fetch-scheduler.js"(exports2) {
129762
129762
  "use strict";
129763
129763
  Object.defineProperty(exports2, "__esModule", { value: true });
129764
- exports2.FetchScheduler = exports2.MAX_AWAITED_JOB_IDS = exports2.MAX_MISSING_JOB_RECHECKS = exports2.ERROR_BACKOFF_MS = exports2.POST_JOB_INTERVAL_MS = exports2.MIN_FETCH_INTERVAL_MS = void 0;
129764
+ exports2.FetchScheduler = exports2.MAX_AWAITED_JOB_IDS = exports2.MAX_MISSING_JOB_RECHECKS = exports2.MAX_ERROR_BACKOFF_MS = exports2.ERROR_BACKOFF_MS = exports2.POST_JOB_INTERVAL_MS = exports2.MIN_FETCH_INTERVAL_MS = void 0;
129765
129765
  var logger_12 = require_logger();
129766
129766
  var utils_12 = require_utils9();
129767
129767
  exports2.MIN_FETCH_INTERVAL_MS = 1e3;
129768
129768
  exports2.POST_JOB_INTERVAL_MS = 3e3;
129769
129769
  exports2.ERROR_BACKOFF_MS = 5e3;
129770
+ exports2.MAX_ERROR_BACKOFF_MS = 6e4;
129770
129771
  exports2.MAX_MISSING_JOB_RECHECKS = 3;
129771
129772
  exports2.MAX_AWAITED_JOB_IDS = 4;
129772
129773
  var FetchScheduler = class {
@@ -129777,6 +129778,7 @@ var require_fetch_scheduler = __commonJS({
129777
129778
  this.stopped = false;
129778
129779
  this.nextFetchNotBefore = 0;
129779
129780
  this.interval = 0;
129781
+ this.consecutiveFailures = 0;
129780
129782
  this.awaitedJobIds = /* @__PURE__ */ new Map();
129781
129783
  }
129782
129784
  start() {
@@ -129842,12 +129844,18 @@ var require_fetch_scheduler = __commonJS({
129842
129844
  if (job.id)
129843
129845
  this.awaitedJobIds.delete(job.id);
129844
129846
  }
129845
- if (jobs.length > 0)
129847
+ if (jobs.length > 0) {
129848
+ this.consecutiveFailures = 0;
129846
129849
  return jobs[0];
129847
- if (this.awaitedJobIds.size === 0)
129850
+ }
129851
+ if (this.awaitedJobIds.size === 0) {
129852
+ this.consecutiveFailures = 0;
129848
129853
  return null;
129854
+ }
129849
129855
  try {
129850
- return await this.claimNudgedJob();
129856
+ const claimed = await this.claimNudgedJob();
129857
+ this.consecutiveFailures = 0;
129858
+ return claimed;
129851
129859
  } catch (error) {
129852
129860
  this.recordDebt("Nudged job lookup failed", error);
129853
129861
  return null;
@@ -129856,6 +129864,7 @@ var require_fetch_scheduler = __commonJS({
129856
129864
  async attemptJob(job) {
129857
129865
  try {
129858
129866
  await this.deps.runJob(job);
129867
+ this.consecutiveFailures = 0;
129859
129868
  this.schedule(exports2.POST_JOB_INTERVAL_MS);
129860
129869
  } catch (error) {
129861
129870
  this.recordDebt("Job run failed", error);
@@ -129894,9 +129903,13 @@ var require_fetch_scheduler = __commonJS({
129894
129903
  }
129895
129904
  /** Nobody else will retry. We already answered the caller 200. */
129896
129905
  recordDebt(what, error) {
129897
- logger_12.logger.error(`[JobFetch] ${what}`, { error: (0, utils_12.errorStack)(error) });
129906
+ this.consecutiveFailures += 1;
129907
+ logger_12.logger.error(`[JobFetch] ${what}`, {
129908
+ error: (0, utils_12.errorStack)(error),
129909
+ consecutiveFailures: this.consecutiveFailures
129910
+ });
129898
129911
  this.checkAgain = true;
129899
- this.schedule(exports2.ERROR_BACKOFF_MS);
129912
+ this.schedule(Math.min(exports2.ERROR_BACKOFF_MS * 2 ** (this.consecutiveFailures - 1), exports2.MAX_ERROR_BACKOFF_MS));
129900
129913
  }
129901
129914
  async throttle() {
129902
129915
  const wait = Math.min(this.nextFetchNotBefore - Date.now(), this.interval);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.514",
3
+ "version": "1.0.515",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "715a6267394907d903d86c1dc1ae0add4c06683702235e803e511288"
32
+ "falconPackageHash": "c5140d1b372c5e46ac8711b10e3bcc084f0e3aac277666ef8406b5a0"
33
33
  }