Giter Site home page Giter Site logo

th2c's Issues

Provide port to Python 3

According to PEP 373, the End Of Life date for Python 2 is 2020 (less than two years from the time of this issue). According to PEP 404 it is further cemented that Python 2 will no longer be actively developed due to their not being a Python 2.8 planned.

For the sake of the project's longevity it is in its best interest to, at the very least, provide a port to Python 3.

The project looks great and I would hate to see it fall to the wayside solely due to it being made for Python 2.x.

Add follow_redirects feature

Follow redirects if configured so, by identifying the next host and spawning a new client to handle the new request.

The new client should not auto_reconnect ( see #5 ).

Expose connection timeout

At the moment, connection timeout is passed as a globally defined constant.
Should be configurable through the client's constructor.

Improve client usability

The client should be usable without defining a new instance for each new host:port. The logic from the client for connection reusability should be moved inside HTTP2ClientConnection.

Add auto_reconnect feature

Given the HTTP/2 context, we'd like this to be stable for a long period of time, so on a specific set of exceptions, we should try reconnecting. Connection cleanup must be properly implemented before we go through with this, or we should create a new connection object.

Stream cleanup from connection fails with KeyError.

in Stream.finish, the line self.connection.end_stream(self) can raise:
Exception in callback <functools.partial object at 0x7fef7c1355d0>#012 Traceback (most recent call last):#012 File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 605, in _run_callback#012 ret = callback()#012 File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 277, in null_wrapper#012 return fn(*args, **kwargs)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 78, in on_timeout#012 None#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 86, in handle_exception#012 self.finish(val)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 259, in finish#012 self.connection.end_stream(self)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/connection.py", line 417, in end_stream#012 del self._ongoing_streams[stream.stream_id]#012KeyError: 3

Noticed this after a RequestTimeout exception

Handle write futures

Streams should handle write futures and exit if anything goes bad.
Can be done easily because streams use connection.flush() in a coroutine so we can yield the future and retry I guess.

Connection should handle its write futures exceptions as failures, gracefully closing the http2 connection.

This is temporary, until we find a better solution for handling these edge cases.

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.