@bithomp/xrpl-api 3.7.24 → 3.7.25
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/lib/connection.js +8 -3
- package/package.json +1 -1
package/lib/connection.js
CHANGED
|
@@ -52,7 +52,7 @@ exports.DEFAULT_API_VERSION = xrpl_1.RIPPLED_API_V1;
|
|
|
52
52
|
const SLOW_DOWN_ERROR_MESSAGES = [
|
|
53
53
|
"slowDown",
|
|
54
54
|
"Unexpected server response: 429",
|
|
55
|
-
"You are placing too much load on the server."
|
|
55
|
+
"You are placing too much load on the server.",
|
|
56
56
|
];
|
|
57
57
|
class Connection extends events_1.EventEmitter {
|
|
58
58
|
constructor(url, type, options = {}) {
|
|
@@ -103,15 +103,20 @@ class Connection extends events_1.EventEmitter {
|
|
|
103
103
|
this.connectionValidation("connect");
|
|
104
104
|
}
|
|
105
105
|
catch (err) {
|
|
106
|
+
const errorMessage = err?.message || err?.name || err;
|
|
106
107
|
this.logger?.warn({
|
|
107
108
|
service: "Bithomp::XRPL::Connection",
|
|
108
109
|
function: "connect",
|
|
109
110
|
url: this.url,
|
|
110
|
-
error:
|
|
111
|
+
error: errorMessage,
|
|
111
112
|
});
|
|
112
113
|
this.removeWatchTimer();
|
|
113
114
|
this.removeClient();
|
|
114
|
-
|
|
115
|
+
let reconnectDelay = LEDGER_CLOSED_TIMEOUT;
|
|
116
|
+
if (SLOW_DOWN_ERROR_MESSAGES.includes(errorMessage)) {
|
|
117
|
+
reconnectDelay = LEDGER_CLOSED_TIMEOUT * 5;
|
|
118
|
+
}
|
|
119
|
+
this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, reconnectDelay);
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
async disconnect() {
|