Skip to content
Snippets Groups Projects
Commit 71db2ccc authored by Jason Salyers's avatar Jason Salyers
Browse files

[JES] Cleanup, but add another log to verify options that aren't specified in...

[JES] Cleanup, but add another log to verify options that aren't specified in setOptions don't get changed
parent 4dcbeedd
No related branches found
No related tags found
2 merge requests!2Fail Over Capability,!1Automatic Fail Over
...@@ -184,8 +184,6 @@ class Steem extends EventEmitter { ...@@ -184,8 +184,6 @@ class Steem extends EventEmitter {
setOptions(options) { setOptions(options) {
Object.assign(this.options, options); Object.assign(this.options, options);
console.log("entering setOptions. options are ", options);
console.log("call stack is: ", new Error().stack);
this._setLogger(options); this._setLogger(options);
this._setTransport(options); this._setTransport(options);
this.transport.setOptions(options); this.transport.setOptions(options);
...@@ -195,18 +193,14 @@ class Steem extends EventEmitter { ...@@ -195,18 +193,14 @@ class Steem extends EventEmitter {
} }
if (options.hasOwnProperty('failover_threshold')) if (options.hasOwnProperty('failover_threshold'))
{ {
console.log("options has failover_threshold property");
config.set('failover_threshold', options.failover_threshold); config.set('failover_threshold', options.failover_threshold);
} }
else
console.log("option does NOT have failover_threshold property. why?");
if (options.hasOwnProperty('alternative_api_endpoints')) if (options.hasOwnProperty('alternative_api_endpoints'))
{ {
console.log("options has alternative_api_endpoints property");
config.set('alternative_api_endpoints', options.alternative_api_endpoints); config.set('alternative_api_endpoints', options.alternative_api_endpoints);
} }
else
console.log("option does NOT have alternative_api_endpoints property. why?"); console.log("done setting options. new options are: ", this.options);
} }
setWebSocket(url) { setWebSocket(url) {
...@@ -369,18 +363,9 @@ class Steem extends EventEmitter { ...@@ -369,18 +363,9 @@ class Steem extends EventEmitter {
notifyError(err, ignore=false) notifyError(err, ignore=false)
{ {
if (err instanceof RPCError || err.message.includes('overseer'))
{
console.log("caught an rpc error, but that likely means it's not an api problem, so not counting it for now while I investigate further");
return;
}
this.errorCount++; this.errorCount++;
console.log("hived api caught an error. count is now: ", this.errorCount, " and failover threshold is: ", this.options.failover_threshold, " alternate endpoints: ", this.options.alternative_api_endpoints);
console.log("and the error is :", err);
if (ignore) if (ignore)
{ {
console.log("but we're being instructed to ignore this error. cherrio good chap, back to it");
return; return;
} }
if (this.errorCount >= this.options.failover_threshold) if (this.errorCount >= this.options.failover_threshold)
...@@ -393,7 +378,6 @@ class Steem extends EventEmitter { ...@@ -393,7 +378,6 @@ class Steem extends EventEmitter {
} }
let nextEndpoint = this.options.alternative_api_endpoints[this.apiIndex]; let nextEndpoint = this.options.alternative_api_endpoints[this.apiIndex];
this.setOptions({url: nextEndpoint}); this.setOptions({url: nextEndpoint});
console.log("switching to another api endpoint after too many failures. new endpoint is: " + nextEndpoint);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment