-
Notifications
You must be signed in to change notification settings - Fork 369
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
Refactor/remove memoization of index name prefix #382
Refactor/remove memoization of index name prefix #382
Conversation
This call relies on @index_name already being memoized, and would otherwise cause infinite recursion
This code looks really cryptic, the control flow is spread all over the source. I would prefer to have less side-effects in methods. |
You are right of course, I moved the memoization into the private method |
Alright, it looks much better. Could I ask you to add specs to consolidate this behavior? Also I'm going to think about this a little bit more over the weekend. |
Sure will do. If you have any other suggestions concerning this change, I'd be happy to incorporate them. |
Any idea why this little change causes so much breakage in other places? |
Because everything else is counting on the name cache, I'm still going to think how to make it the best way, unfortunately I didn't have a chance yet :( |
In master already |
There is an open pull request #314 concerning the issue that for multitenant applications the index prefix needs to be set dynamically (#225) which is currently not possible since the index name is memoized. I think there has been some misunderstanding concerning the point of the memoization which is not performance related, but rather a result of the fact that
index_name
is both a getter and setter (unfortunately) and it should be memoized if set explicitly.This behavior is preserved in the changes I propose by saving the
index_name_stem
when it is set while allowing the prefix to be reevaluated every timeindex_name
is accessed.