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

Making LocaleBorg thread-safe. #2071

Merged
merged 4 commits into from Sep 13, 2015
Merged

Making LocaleBorg thread-safe. #2071

merged 4 commits into from Sep 13, 2015

Conversation

felixfontein
Copy link
Contributor

Fixes #2046 as discussed there.

…ince current_lang is now a property function.
@felixfontein
Copy link
Contributor Author

The failed test is due to a gist not being loaded. I've seen this error several times appearing and disappearing over the last hours (for different branches), so I assume it's not my fault ;)

@felixfontein
Copy link
Contributor Author

I did some more testing, it seems to work fine. I also did some timing tests with one of my smaller blogs; the new code with a thread local variable and a lock didn't result in a noticeable performance drop (11.1 vs. 11.2 seconds for master vs threadsafe-localeborg in single-threaded mode), and this performance drop was the same when I replaced the Lock() object with an object with empty __enter__ and __exit__ methods and the thread-local storage with a simple shared state; so it is probably more the fault of formatted_date calling __set_locale and/or current_lang calling __get_shared_state instead of directly accessing it.

@ralsina
Copy link
Member

ralsina commented Sep 13, 2015

LGTM let's merge it and see.

ralsina added a commit that referenced this pull request Sep 13, 2015
@ralsina ralsina merged commit 6050835 into master Sep 13, 2015
@ralsina ralsina deleted the threadsafe-localeborg branch September 13, 2015 14:05
@felixfontein
Copy link
Contributor Author

Thanks for merging!

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.

None yet

2 participants