@replit/river 0.15.3 → 0.15.4

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.
@@ -706,6 +706,7 @@ var ClientTransport = class extends Transport {
706
706
  log?.debug(
707
707
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
708
708
  );
709
+ this.retryBudget.startRestoringBudget(parsed.from);
709
710
  return { instanceId, from: parsed.from };
710
711
  }
711
712
  /**
@@ -722,10 +723,9 @@ var ClientTransport = class extends Transport {
722
723
  }
723
724
  let reconnectPromise = this.inflightConnectionPromises.get(to);
724
725
  if (!reconnectPromise) {
725
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
726
726
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
727
727
  if (!this.retryBudget.hasBudget(to)) {
728
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
728
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
729
729
  log?.warn(`${this.clientId} -- ${errMsg}`);
730
730
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
731
731
  return;
@@ -735,6 +735,9 @@ var ClientTransport = class extends Transport {
735
735
  if (backoffMs > 0) {
736
736
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
737
737
  }
738
+ log?.info(
739
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
740
+ );
738
741
  this.retryBudget.consumeBudget(to);
739
742
  reconnectPromise = sleep.then(() => {
740
743
  if (!canProceedWithConnection()) {
@@ -748,7 +751,6 @@ var ClientTransport = class extends Transport {
748
751
  conn.close();
749
752
  throw new Error("transport state is no longer open");
750
753
  }
751
- this.retryBudget.startRestoringBudget(to);
752
754
  this.sendHandshake(to, conn);
753
755
  return conn;
754
756
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5XMMDOLH.js";
3
+ } from "./chunk-5TYDJKOP.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5XMMDOLH.js";
3
+ } from "./chunk-5TYDJKOP.js";
4
4
 
5
5
  // transport/transforms/messageFraming.ts
6
6
  import { Transform } from "node:stream";
@@ -945,6 +945,7 @@ var ClientTransport = class extends Transport {
945
945
  log?.debug(
946
946
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
947
947
  );
948
+ this.retryBudget.startRestoringBudget(parsed.from);
948
949
  return { instanceId, from: parsed.from };
949
950
  }
950
951
  /**
@@ -961,10 +962,9 @@ var ClientTransport = class extends Transport {
961
962
  }
962
963
  let reconnectPromise = this.inflightConnectionPromises.get(to);
963
964
  if (!reconnectPromise) {
964
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
965
965
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
966
966
  if (!this.retryBudget.hasBudget(to)) {
967
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
967
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
968
968
  log?.warn(`${this.clientId} -- ${errMsg}`);
969
969
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
970
970
  return;
@@ -974,6 +974,9 @@ var ClientTransport = class extends Transport {
974
974
  if (backoffMs > 0) {
975
975
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
976
976
  }
977
+ log?.info(
978
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
979
+ );
977
980
  this.retryBudget.consumeBudget(to);
978
981
  reconnectPromise = sleep.then(() => {
979
982
  if (!canProceedWithConnection()) {
@@ -987,7 +990,6 @@ var ClientTransport = class extends Transport {
987
990
  conn.close();
988
991
  throw new Error("transport state is no longer open");
989
992
  }
990
- this.retryBudget.startRestoringBudget(to);
991
993
  this.sendHandshake(to, conn);
992
994
  return conn;
993
995
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MXHIHC3U.js";
3
+ } from "../../../chunk-QF3XH65C.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-5TYDJKOP.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MXHIHC3U.js";
3
+ } from "../../../chunk-QF3XH65C.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-5TYDJKOP.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -849,6 +849,7 @@ var ClientTransport = class extends Transport {
849
849
  log?.debug(
850
850
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
851
851
  );
852
+ this.retryBudget.startRestoringBudget(parsed.from);
852
853
  return { instanceId, from: parsed.from };
853
854
  }
854
855
  /**
@@ -865,10 +866,9 @@ var ClientTransport = class extends Transport {
865
866
  }
866
867
  let reconnectPromise = this.inflightConnectionPromises.get(to);
867
868
  if (!reconnectPromise) {
868
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
869
869
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
870
870
  if (!this.retryBudget.hasBudget(to)) {
871
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
871
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
872
872
  log?.warn(`${this.clientId} -- ${errMsg}`);
873
873
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
874
874
  return;
@@ -878,6 +878,9 @@ var ClientTransport = class extends Transport {
878
878
  if (backoffMs > 0) {
879
879
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
880
880
  }
881
+ log?.info(
882
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
883
+ );
881
884
  this.retryBudget.consumeBudget(to);
882
885
  reconnectPromise = sleep.then(() => {
883
886
  if (!canProceedWithConnection()) {
@@ -891,7 +894,6 @@ var ClientTransport = class extends Transport {
891
894
  conn.close();
892
895
  throw new Error("transport state is no longer open");
893
896
  }
894
- this.retryBudget.startRestoringBudget(to);
895
897
  this.sendHandshake(to, conn);
896
898
  return conn;
897
899
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-NSJVTNVQ.js";
3
+ } from "../../../chunk-DEYIG5LG.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-5TYDJKOP.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-NSJVTNVQ.js";
3
+ } from "../../../chunk-DEYIG5LG.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-5TYDJKOP.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import "../../../chunk-H4BYJELI.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
@@ -880,6 +880,7 @@ var ClientTransport = class extends Transport {
880
880
  log?.debug(
881
881
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
882
882
  );
883
+ this.retryBudget.startRestoringBudget(parsed.from);
883
884
  return { instanceId, from: parsed.from };
884
885
  }
885
886
  /**
@@ -896,10 +897,9 @@ var ClientTransport = class extends Transport {
896
897
  }
897
898
  let reconnectPromise = this.inflightConnectionPromises.get(to);
898
899
  if (!reconnectPromise) {
899
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
900
900
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
901
901
  if (!this.retryBudget.hasBudget(to)) {
902
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
902
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
903
903
  log?.warn(`${this.clientId} -- ${errMsg}`);
904
904
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
905
905
  return;
@@ -909,6 +909,9 @@ var ClientTransport = class extends Transport {
909
909
  if (backoffMs > 0) {
910
910
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
911
911
  }
912
+ log?.info(
913
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
914
+ );
912
915
  this.retryBudget.consumeBudget(to);
913
916
  reconnectPromise = sleep.then(() => {
914
917
  if (!canProceedWithConnection()) {
@@ -922,7 +925,6 @@ var ClientTransport = class extends Transport {
922
925
  conn.close();
923
926
  throw new Error("transport state is no longer open");
924
927
  }
925
- this.retryBudget.startRestoringBudget(to);
926
928
  this.sendHandshake(to, conn);
927
929
  return conn;
928
930
  });
@@ -6,7 +6,7 @@ import {
6
6
  ServerTransport,
7
7
  Session,
8
8
  Transport
9
- } from "../chunk-5XMMDOLH.js";
9
+ } from "../chunk-5TYDJKOP.js";
10
10
  import {
11
11
  OpaqueTransportMessageSchema,
12
12
  TransportMessageSchema
@@ -5,7 +5,7 @@ import {
5
5
  import "../chunk-RPIDSIQG.js";
6
6
  import {
7
7
  Session
8
- } from "../chunk-5XMMDOLH.js";
8
+ } from "../chunk-5TYDJKOP.js";
9
9
  import {
10
10
  coerceErrorString
11
11
  } from "../chunk-GFRAOY75.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@replit/river",
3
3
  "description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
4
- "version": "0.15.3",
4
+ "version": "0.15.4",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {