feat: add retry logic to external signer - #2004
Conversation
fa008ba to
8eb1490
Compare
Codecov Report
@@ Coverage Diff @@
## master #2004 +/- ##
===========================================
+ Coverage 0 52.44% +52.44%
===========================================
Files 0 6 +6
Lines 0 553 +553
Branches 0 85 +85
===========================================
+ Hits 0 290 +290
- Misses 0 258 +258
- Partials 0 5 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
when extending Error you must set the prototype otherwise it will break the prototype chain
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
There was a problem hiding this comment.
Thanks for the feedback @lifeiscontent! Is this just a matter of adding the following line under super()?
Object.setPrototypeOf(this, new.target.prototype);
There was a problem hiding this comment.
@lifeiscontent that fix is no longer needed since we switched to targeting ES2019
d46491b to
26e9164
Compare
if the request to the external signer fails with ECONNREFUSED, retry the request three times with exponentially increasing timeout up to 3 times. Ticket: BG-43083
26e9164 to
05e198a
Compare
tylerlevine
left a comment
There was a problem hiding this comment.
small nit, feel free to handle it in a follow up PR
| .type('json') | ||
| .send({ txPrebuild: params.txPrebuild, pubs: params.pubs }), | ||
| (err, tryCount) => { | ||
| console.error(`attempt number ${tryCount}`); |
There was a problem hiding this comment.
let's make this a debug instead and make it a little more informative
| console.error(`attempt number ${tryCount}`); | |
| debug(`failed to connect to external signer (attempt ${tryCount}, error: ${err.message})`); |
if the request to the external signer fails with
ECONNREFUSED, retry therequest three times with exponentially increasing timeout up to 3 times.
Ticket: BG-43083