-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I configure the retry settings? #84
Comments
@lanmower I've come up with a solution. Assuming you are referring to the interface EnhancedNodeosActionReaderOptions extends NodeosActionReaderOptions {
numRetries?: number;
waitTimeMs?: number;
}
class EnhancedNodeosActionReader extends NodeosActionReader {
private numRetries: number;
private waitTimeMs: number;
constructor(props: EnhancedNodeosActionReaderOptions) {
super(props);
this.numRetries = props.numRetries ? props.numRetries : 120;
this.waitTimeMs = props.waitTimeMs ? props.waitTimeMs : 250;
}
/**
* Thin wrapper around the original implementation of `getBlock`.
* We can now pass the optional `numRetries` and `waitTimeMs`.
*/
public async getBlock(
blockNumber: number,
numRetries?: number,
waitTimeMs?: number
): Promise<NodeosBlock> {
return super.getBlock(
blockNumber,
numRetries ? numRetries : this.numRetries,
waitTimeMs ? waitTimeMs : this.waitTimeMs
);
}
// Other class methods that you can change...
} In the above example only Finally, a new instance of const actionReader = new EnhancedNodeosActionReader({
nodeosEndpoint: "https://some-endpoint.com"
startAtBlock: -1,
// New options!
numRetries: 3,
waitTimeMs: 300
}); |
However, I noticed today that the retry mechanism is broken, so there is no point in changing the retry parameters until this is fixed and released. |
aah! i noticed it too :) |
Seems like the latest built release on NPM is different from the current source code and does not include the fix from #91. |
I like the idea, I guess if demux wasn't abandoned 3-4 months ago I'd be
happily testing and improving the code...
I ended up writing a simple block by block reader, which is way way dumber
and less refined than demux, but at least it works, demux is unusable
without it recovering from failure properly, and it could take a day to
test and fix it but it could take a month.
…On Fri, Jun 7, 2019 at 11:30 PM Matei Radu ***@***.***> wrote:
@lanmower <https://github.com/lanmower> I've come up with a solution.
Assuming you are referring to the NodeosActionReader, you can extend it
and create your own reader. Doing so, you can accept additional constructor
options and propagate the number of retries and retry delay time to the
existing implementations:
interface EnhancedNodeosActionReaderOptions extends NodeosActionReaderOptions {
numRetries?: number;
waitTimeMs?: number;
}
class EnhancedNodeosActionReader extends NodeosActionReader {
private numRetries: number;
private waitTimeMs: number;
constructor(props: EnhancedNodeosActionReaderOptions) {
super(props);
this.numRetries = props.numRetries ? props.numRetries : 120;
this.waitTimeMs = props.waitTimeMs ? props.waitTimeMs : 250;
}
/** * Thin wrapper around the original implementation of `getBlock`. * We can now pass the optional `numRetries` and `waitTimeMs`. */
public async getBlock(
blockNumber: number,
numRetries?: number,
waitTimeMs?: number
): Promise<NodeosBlock> {
return super.getBlock(
blockNumber,
numRetries ? numRetries : this.numRetries,
waitTimeMs ? waitTimeMs : this.waitTimeMs
);
}
// Other class methods that you can change...
}
In the above example only getBlock was changed but you can/should do the
same thing for the other methods as well.
Finally, a new instance of EnhancedNodeosActionReader would look like
this:
const actionReader = new EnhancedNodeosActionReader({
nodeosEndpoint: "https://some-endpoint.com"
startAtBlock: -1,
// New options!
numRetries: 3,
waitTimeMs: 300
});
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#84?email_source=notifications&email_token=AAFAPI2JG46NRCJMMZYH3HTPZLHN7A5CNFSM4HNJR5V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXHBLVY#issuecomment-500045271>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFAPI3XOMAVIE533GWG7WTPZLHN7ANCNFSM4HNJR5VQ>
.
|
I would like to configure it to wait longer between retries... how would I go about doing that? I've been trying to figure out for days.
The text was updated successfully, but these errors were encountered: