Skip to content
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

Auto backoff catchup #106

Merged
merged 4 commits into from
Jan 12, 2024
Merged

Conversation

matthew1001
Copy link
Contributor

@matthew1001 matthew1001 commented Jan 8, 2024

This PR is intended to resolve FireFly issue hyperledger/firefly#1370

The design is based on the assumption that different JSON/RPC providers will return slightly different errors for this scenario, so the event listener uses a (configurable) regex pattern when an error is returned from eth_getLogs to decide if it should be retried with a smaller catchupPageSize.

If eth_getLogs returns such an error, the page size is halved (the initial default being 500) until one of the following is true:

the calls are successful
the catchupPageSize reaches 1
(Reducing catchupPageSize to 1 is likely to mean the connector never catches up with main. It feels arbitrary to me however, to pick a higher value (10? 20?) that we set as a minimum to reduce the value down to so I've left the minimum as 1 for now.)

The value of catchupPageSize is only changed for the current runtime. This means that if the JSON/RPC endpoint is upgraded to support larger responses later then a restart of FireFly will return to the default catchupPageSize.

I haven't gone to the complexity of trying to slowly increase catchupPageSize back to a higher value, since this adds complexity for what feels like relatively little benefit. If the use knows the limit they can manually configure it more precisely, but this PR at least moves FF along to work correctly for limited-resource API providers. It's certainly an option for a future PR though.

@matthew1001 matthew1001 requested a review from a team as a code owner January 8, 2024 16:45
Signed-off-by: Matthew Whitehead <[email protected]>
@matthew1001 matthew1001 force-pushed the auto-backoff-catchup branch from 1c62ce0 to 321864d Compare January 8, 2024 16:58
@nguyer nguyer merged commit a70cacf into hyperledger:main Jan 12, 2024
2 checks passed
@nguyer nguyer deleted the auto-backoff-catchup branch January 12, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants