Remove memoization from index name #318
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Simple change but maybe one that needs some discussion. The reason for making this change is that the value that needs to be assigned to
@index_name
may change between calls toindex_name
, such as between requests in multitenant environment.If for example the
default_prefix
were set to a lambda or were overridden to be something dynamic, it wouldn't be re-initialised between requests.We can sort this out by just not memoizing that variable, however this does introduce a performance overhead (it'll re-evaluate the regex/demodulize etc. every time and will create a new variable) however I think this overhead is very minor compared to the benefit.
If you'd prefer not to have the overhead at all I could introduce this as a configurable option (
dynamic_index_names: true
or something) but then that's maybe a step too far.