convex 1.24.6 → 1.24.7-alpha.0

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.
@@ -28,7 +28,7 @@ var convex = (() => {
28
28
  });
29
29
 
30
30
  // src/index.ts
31
- var version = "1.24.6";
31
+ var version = "1.24.7-alpha.0";
32
32
 
33
33
  // src/values/base64.ts
34
34
  var base64_exports = {};
@@ -1647,7 +1647,13 @@ var convex = (() => {
1647
1647
  }
1648
1648
  this.logger.log(msg);
1649
1649
  }
1650
- this.scheduleReconnect();
1650
+ if (event.reason?.includes("SubscriptionsWorkerFullError")) {
1651
+ this.scheduleReconnect("SubscriptionsWorkerFullError");
1652
+ } else if (event.reason?.includes("TooManyConcurrentRequests")) {
1653
+ this.scheduleReconnect("TooManyConcurrentRequests");
1654
+ } else {
1655
+ this.scheduleReconnect("unknown");
1656
+ }
1651
1657
  return;
1652
1658
  };
1653
1659
  }
@@ -1705,9 +1711,9 @@ var convex = (() => {
1705
1711
  this.closeAndReconnect("InactiveServer");
1706
1712
  }, this.serverInactivityThreshold);
1707
1713
  }
1708
- scheduleReconnect() {
1714
+ scheduleReconnect(reason) {
1709
1715
  this.socket = { state: "disconnected" };
1710
- const backoff = this.nextBackoff();
1716
+ const backoff = this.nextBackoff(reason);
1711
1717
  this.logger.log(`Attempting reconnect in ${backoff}ms`);
1712
1718
  setTimeout(() => this.connect(), backoff);
1713
1719
  }
@@ -1727,7 +1733,7 @@ var convex = (() => {
1727
1733
  case "ready": {
1728
1734
  this.lastCloseReason = closeReason;
1729
1735
  void this.close();
1730
- this.scheduleReconnect();
1736
+ this.scheduleReconnect("client");
1731
1737
  return;
1732
1738
  }
1733
1739
  default: {
@@ -1900,8 +1906,9 @@ var convex = (() => {
1900
1906
  _logVerbose(message) {
1901
1907
  this.logger.logVerbose(message);
1902
1908
  }
1903
- nextBackoff() {
1904
- const baseBackoff = this.initialBackoff * Math.pow(2, this.retries);
1909
+ nextBackoff(reason) {
1910
+ const initialBackoff = reason === "SubscriptionsWorkerFullError" ? 3e3 : reason === "TooManyConcurrentRequests" ? 3e3 : this.initialBackoff;
1911
+ const baseBackoff = initialBackoff * Math.pow(2, this.retries);
1905
1912
  this.retries += 1;
1906
1913
  const actualBackoff = Math.min(baseBackoff, this.maxBackoff);
1907
1914
  const jitter = actualBackoff * (Math.random() - 0.5);