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

Lost configuration on ContentfulModel::Management.new #131

Open
MattFenelon opened this issue May 23, 2019 · 0 comments
Open

Lost configuration on ContentfulModel::Management.new #131

MattFenelon opened this issue May 23, 2019 · 0 comments

Comments

@MattFenelon
Copy link
Contributor

MattFenelon commented May 23, 2019

This is related to #130.

I'm not sure if this is a bug in this library or contentful/contentful-management.rb.

In the initialiser for Contentful::Management::Client the initialised object is saved to a thread variable.

https://github.com/contentful/contentful-management.rb/blob/6401797059672994269220594dff8c084957de27/lib/contentful/management/client.rb#L91-L98

The thread variable is accessed via the shared_instance method in various places in contentful/contentful-management.rb. Any new initialisation of Contentful::Management::Client overwrites the thread variable, causing subsequent calls within contentful/contentful-management.rb to use the new instance, with the new configuration. This caused me issues with default_locale, which I dealt with in #130. I guess this could also cause issues with options like raise_errors.

As I said, I'm not sure if this is a bug in this library or contentful/contentful-management.rb. The behaviour in contentful/contentful-management.rb is by-design so perhaps this library should be made to use the shared_instance variable.

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

No branches or pull requests

1 participant