starknet 10.6.5 → 10.6.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.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.global.js +23 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7763,6 +7763,8 @@ var WebSocketChannel = class {
|
|
|
7763
7763
|
this.reconnectStabilityTimeoutId = null;
|
|
7764
7764
|
}
|
|
7765
7765
|
this.userInitiatedClose = true;
|
|
7766
|
+
this.isReconnecting = false;
|
|
7767
|
+
this._rejectRequestQueue("the connection was closed by the user");
|
|
7766
7768
|
this.websocket.close(code, reason);
|
|
7767
7769
|
}
|
|
7768
7770
|
/**
|
|
@@ -7836,6 +7838,24 @@ var WebSocketChannel = class {
|
|
|
7836
7838
|
this.sendReceive(method, params).then(resolve).catch(reject);
|
|
7837
7839
|
});
|
|
7838
7840
|
}
|
|
7841
|
+
/**
|
|
7842
|
+
* Reject every request still waiting in the queue.
|
|
7843
|
+
*
|
|
7844
|
+
* A queued request carries no timeout of its own: the `requestTimeout` timer is only
|
|
7845
|
+
* armed once the request is actually put on the wire. So once the channel reaches a state
|
|
7846
|
+
* where the queue can never be flushed — reconnection gave up, or the user closed the
|
|
7847
|
+
* connection — the queued promises would stay pending forever, and no caller-side timeout
|
|
7848
|
+
* could rescue them. Settling them here is the only way out.
|
|
7849
|
+
*/
|
|
7850
|
+
_rejectRequestQueue(reason) {
|
|
7851
|
+
if (this.requestQueue.length === 0) return;
|
|
7852
|
+
const pending = this.requestQueue;
|
|
7853
|
+
this.requestQueue = [];
|
|
7854
|
+
logger.info(`WebSocket: Rejecting ${pending.length} queued request(s). Reason: ${reason}.`);
|
|
7855
|
+
pending.forEach(({ method, reject }) => {
|
|
7856
|
+
reject(new WebSocketNotConnectedError(`Request ${method} was never sent: ${reason}`));
|
|
7857
|
+
});
|
|
7858
|
+
}
|
|
7839
7859
|
async _restoreSubscriptions() {
|
|
7840
7860
|
const oldSubscriptions = Array.from(this.activeSubscriptions.values());
|
|
7841
7861
|
this.activeSubscriptions.clear();
|
|
@@ -7879,6 +7899,9 @@ var WebSocketChannel = class {
|
|
|
7879
7899
|
if (this.reconnectAttempts >= this.reconnectOptions.retries) {
|
|
7880
7900
|
logger.error("WebSocket: Maximum reconnection retries reached. Giving up.");
|
|
7881
7901
|
this.isReconnecting = false;
|
|
7902
|
+
this._rejectRequestQueue(
|
|
7903
|
+
`reconnection gave up after ${this.reconnectOptions.retries} attempts`
|
|
7904
|
+
);
|
|
7882
7905
|
return;
|
|
7883
7906
|
}
|
|
7884
7907
|
this.reconnectAttempts += 1;
|