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

feat: forester: do not retry on not eligible slots #1089

Merged
merged 4 commits into from
Aug 18, 2024

Conversation

sergeytimoshin
Copy link
Contributor

Introduced a new error variant NotEligible in ForesterError.
Updated the eligibility check to return this error and handle it appropriately during the transaction processing loop.

@sergeytimoshin sergeytimoshin changed the title feat forester: do not retry on not eligible slots feat: forester: do not retry on not eligible slots Aug 14, 2024
);
return Err(e);
}
let delay = BASE_RETRY_DELAY * 2u32.pow(retries as u32);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theoretic nit: could use saturating_pow to prevent overflows. anyway don't think it's important because retrys are not gonna overflow in practice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

@SwenSchaeferjohann SwenSchaeferjohann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

}
}
}
Err(ForesterError::NotEligible) => {
Copy link
Contributor

@ananas-block ananas-block Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, are there other errors that we need to handle?
For example, edge cases changing epochs before start or after it has ended (might be covered haven't checked).

Copy link
Contributor Author

@sergeytimoshin sergeytimoshin Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are still many places in forester where I use ForesterError::Custom(String) generic errors, I should definitely use less generic errors for the specific cases. It's on my list.

…ted the eligibility check to return this error and handle it appropriately during the transaction processing loop.
@sergeytimoshin sergeytimoshin force-pushed the sergey/forester-dont-retry-if-not-eligible branch from 33fe10e to a00f1b4 Compare August 16, 2024 09:25

Unverified

This user has not yet uploaded their public signing key.

Verified

This commit was signed with the committer’s verified signature.
BethGriggs Bethany Griggs
Modified the retry delay calculation by using `saturating_mul` and `saturating_pow` to avoid potential overflow issues. This ensures the application remains stable even if the retry count becomes excessively high.

Verified

This commit was signed with the committer’s verified signature.
BethGriggs Bethany Griggs
@sergeytimoshin sergeytimoshin merged commit 673e30b into main Aug 18, 2024
7 checks passed
@sergeytimoshin sergeytimoshin deleted the sergey/forester-dont-retry-if-not-eligible branch August 18, 2024 16:16
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.

None yet

3 participants