Skip to content

Conversation

@travisbell
Copy link

After the update on #723 (#724) I18n became incompatible with web servers like Falcon, that serve every request in a new fiber. You can read my comment on that issue for a bit more context.

This PR introduces a new option called I18n.isolation_scope which allows you to configure where you'd like the instance of I18n::Config to be stored. By default it stays as a thread variable, but it can be changed to use fibers like so:

I18n.isolation_scope = :fiber

By using :fiber we store the config in a fiber local Fiber[:i18n_config] instead of thread local Thread.current.thread_variable_get.

@travisbell
Copy link
Author

P.S. I looked into using the value from ActiveSupport::IsolatedExecutionState.isolation_level but since ActiveSupport is not a hard requirement for I18n, I don't think it made sense. For any apps using fibers like this, they'll just need to set both values. That is, unless we add some complexity to the check.

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