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

felixfontein commented Sep 11, 2015

Fixes #2046 as discussed there.

@felixfontein felixfontein force-pushed the threadsafe-localeborg branch from b22ea79 to 5de9795 Sep 11, 2015
…ince current_lang is now a property function.
@felixfontein
Copy link
Contributor Author

felixfontein commented Sep 11, 2015

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

felixfontein commented Sep 13, 2015

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
Making LocaleBorg thread-safe.
@ralsina ralsina merged commit 6050835 into master Sep 13, 2015
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ralsina ralsina deleted the threadsafe-localeborg branch Sep 13, 2015
@felixfontein
Copy link
Contributor Author

felixfontein commented Sep 13, 2015

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.