Fixes #369 thread issue when calling translate with fallbacks #374
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.
This pull request is a fix for the thread issues discuss in #369.
In Version 0.7.0 the
I18n::Backend::Fallbacks#translate
method had an internal option calledfallback
. This was set totrue
when the fallback logic was in progress and was used as a way to prevent fallbacks from getting stuck in an infinite loop:Although
fallback
was an internal option, this wiki made reference to afallbacks
flag that could be used to disable fallbacks.Unfortunately the
fallbacks
flag didn't do anything so pull request #354 made a change to allow for passingfallback: false
as a way to disable the fallback logic. When that was done this commit added an instance variable called@fallback_locked
which breaks thread-safety:This pull request will remove the instance variable and revert back to the local
options
hash, using a new internal option called:fallback_in_progress
to control the fallback looping structure in a way that is thread-safe.