Git Product home page Git Product logo

Comments (3)

vinnyspb avatar vinnyspb commented on June 26, 2024

But does the library actually open-close connections constantly? My understanding was that connection is left opened after the first push, and then you can reuse it as many times as you want from as many threads as you want.

Thread-safety assumption comes from hyper package changelog (used for HTTP20Connection class):

The HTTP20Connection object is now thread-safe, so long as stream IDs are used on all method calls.

And as it is a HTTP/2 connection, library heavily reuses streams inside a single connection, which per my understanding is not the same as a connection pool of course, but gives you similar benefits.

Maybe the author could comment more on that.

from pyapns2.

tamakisquare avatar tamakisquare commented on June 26, 2024

@vinnyspb, good point! I missed out the fact that PyAPNs2 relies on http20, so I was expecting to see code managing connection at the PyAPNs2 library level and I didn't see any. As it turns out, I checked out the source code of the http20 package after seeing your comment, the connection management has already been well taken care of by http20. Thanks for your insight.

from pyapns2.

avium avatar avium commented on June 26, 2024

My understanding was that connection is left opened after the first push, and then you can reuse it as many times as you want from as many threads as you want.

I'm concerned there may be thread-safety issues. For example, send_notification_batch() doesn't seem to take into account that there may be open streams pending from other calls to that method on other threads. If I'm not mistaken, this could result in too many (or more than __max_concurrent_streams) simultaneous requests.

from pyapns2.

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.