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

Make sure Redis.send(..) methods are tail recursive #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sptz45
Copy link

@sptz45 sptz45 commented Jan 25, 2023

We need to do that cause if we have a faulty Redis server that has issues with connections the reconnect-on-error functionality of those methods can result in StackOverflowError.

We had to create a private method for each send(..) method cause simply adding @tailrec would produce the following compiler error: "could not optimize @tailrec annotated method send: it is neither private nor final so can be overridden". We also opted for adding private methods instead of defining them inside each method in order to make fewer changes and better preserve the git history.

We need to do that cause if we have a faulty Redis server that has
issues with connections the reconnect-on-error functionality of those
methods can result in `StackOverflowError`.

We had to create a private method for each `send(..)` method cause simply
adding `@tailrec` would produce the following compiler error: "could not
optimize @tailrec annotated method send: it is neither private nor final
so can be overridden". We also opted for adding private methods instead
of defining them inside each method in order to make fewer changes and
better preserve the git history.
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.

1 participant