Giter VIP home page Giter VIP logo

Comments (5)

Cidan avatar Cidan commented on July 18, 2024 2

Absolutely!

So what I've been working on is a decoupled system in which outbound Twitch API calls are processed in their own stand alone microservice via RPC's. Right now, if I want to call a Twitch API using this library, I would need to have some sort of locking mechanism to ensure concurrent use of the library isn't done across multiple users.

For example, let's say I have 200 users with 200 user tokens that have been granted permission to a bot. Every time I want to call the Twitch API for something, I would send an RPC to the microservice I wrote that contains your Twitch library. This service would then call your Twitch library with the end user credentials by first calling SetUserAccessToken method on the client from your library.

The problem here is, I can't have multiple tokens in use concurrently across the same instantiation of this library, because the user token it self is stored as state in the library. I thus need to either implement locking so that only one user can use a client at a time, i.e. sync.Lock or client pooling.

Both solutions are undesirable as the API is stateless by nature -- there should be no need to lock or pool when the lowest level of the API (i.e. the http calls) is stateless.

What I propose is something like:

resp, err := client.GetUsers(
    &helix.UsersParams{
        IDs:    []string{"26301881", "18074328"},
        Logins: []string{"summit1g", "lirik"},
    },
    &helix.AuthOptions{
        UserAccessToken: "some-access-token",
    },
)

Does that clarify the problem?

Thanks!

from helix.

nicklaw5 avatar nicklaw5 commented on July 18, 2024

So I can understand your problem better, are you able to provide an example what you're trying to achieve with this library in its current state and the issues you're having?

from helix.

nicklaw5 avatar nicklaw5 commented on July 18, 2024

I agree that is generally a good idea on the surface, but without diving in and having a deeper look I'm not sure what changes need to be implemented.

I'm also rather busy at the moment and not sure when I'll be able to have a look at this.

from helix.

Cidan avatar Cidan commented on July 18, 2024

I'll take a look and outline what changes would need to be done in order to get this in place. At the very least, we should be able to measure the level of effort here.

from helix.

graytonio avatar graytonio commented on July 18, 2024

I'm running into similar issues with wanting to have multitenant applications has this feature been abandoned?

from helix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.