Coder Social home page Coder Social logo

Comments (5)

Dreamsorcerer avatar Dreamsorcerer commented on May 20, 2024

My first thought is that this is probably intended to be done by creating 2 connectors/sessions and having different parameters for each.

from aiohttp.

copdips avatar copdips commented on May 20, 2024

Yes, using multiple sessions can work as well. However, my actual use case involves having multiple endpoints behind the same host, each with different maximum concurrency limits. Managing multiple sessions might become burdensome due to the need for numerous variables in the code and extensive conditional logic to select the appropriate session object for different endpoints, etc.

That's why I asked for limit_per_url as a nice wraper to move all these "heavy works" from user code into aiohttp.

from aiohttp.

copdips avatar copdips commented on May 20, 2024

I can even envision, if possible, having two levels of sessions.

The first level would involve creating multiple sessions for different groups of endpoints, such as a session for financial team endpoints, another for sales team endpoints, and one more for technical team endpoints, etc.

The second level would entail, within each session, leveraging limit_per_url or limit_per_endpoint (including the HTTP verb) to achieve fine-grained control.

All these sessions will target to the same host, as entreprises often use an API gateway in front of all the private APIs.

from aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on May 20, 2024

Managing multiple sessions might become burdensome due to the need for numerous variables in the code and extensive conditional logic to select the appropriate session object for different endpoints, etc.

I think that's called a dict. ;)

I'm not saying that it's a terrible idea, but it seems like a bit of an obscure use case we'd then need to maintain. It could also have a performance impact on other users depending on how it's implemented. So, I suspect there won't be much interest in implementing it. Either way, if you want something that works now (or even this year), you'll be best using multiple sessions.

from aiohttp.

copdips avatar copdips commented on May 20, 2024

thanks for your shares, I'll close this request.

from aiohttp.

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.