Skip to content

Make helpers thread-safe #114

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

Merged
merged 1 commit into from
Feb 12, 2020

Conversation

kylefox
Copy link
Contributor

@kylefox kylefox commented Feb 12, 2020

Fixes #112.

tl;dr — using both inline_svg_tag and inline_svg_pack_tag is not thread-safe because multiple threads could be modifying InlineSvg.configuration.asset_finder (a global variable) simultaneously. This pull request uses thread-local variables to swap the current asset finder, rather than change the global variable directly.

Threads kinda make my head spin, so gotchas & feedback are appreciated 🙏

@jamesmartin
Copy link
Owner

Tested out locally and can't see any regressions.

@jamesmartin
Copy link
Owner

Thanks again for opening this, @kylefox. ✨

@jamesmartin
Copy link
Owner

Released in v1.7.0.

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.

⚠️ Using both asset pipeline and webpacker is not thread safe
2 participants