Skip to content

Lost configuration on ContentfulModel::Management.new #131

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions