Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.
This repository was archived by the owner on Oct 6, 2026. It is now read-only.

Get rid of Class variable storage and move to instance storage #191

Description

@corby

I'm building an admin/monitoring server that handles requests from both out production and qa Shopify store.
In the current setup, the user/password/site_uri are stored at the class level, so I can't create a prod session and a qa session and store them in memory.
For every request to the REST server I have to clear the current class variables and set for requested environment.

Additionally, this is not thread safe. If two REST requests arrive at the same time for different endpoints, they will clobber each other.

Activity

  1. metatick commented on Nov 16, 2017

    @metatick

    +1 for this - very easy to solve this and will prevent unexpected behaviour for apps running under different environments (eg. threads vs processes, persistent vs cgi).

  2. VichoReyes commented on Aug 10, 2023

    @VichoReyes

    (maybe this wasn't in place when you raised this issue, I'm not sure)

    @corby The sessions are actually in thread-local storage. I don't fully understand how it works (I'm reading about metaclasses now) but the ShopifyResource class somehow uses ShopifyResourceMeta properties, which are based on the _theadlocal object, an instance of threading.local.

    I believe this makes them thread-safe.

  3. odie5533 commented on Dec 28, 2023

    @odie5533

    @corby The sessions are actually in thread-local storage.

    It also makes it difficult to work on them in an async environment because work is not always done on the same thread.

  4. Suleimanlatrsh commented on Oct 6, 2026

    @Suleimanlatrsh
    Contributor

    Thanks for contributing! This package is deprecated and we're archiving this repo, so we're closing all open issues and PRs. Please use shopify-app-python instead, and open new issues there. More context: Rethinking support for PHP/Python packages

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions