Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use session for requests #26

Closed
modong opened this issue Mar 4, 2016 · 0 comments
Closed

use session for requests #26

modong opened this issue Mar 4, 2016 · 0 comments
Milestone

Comments

@modong
Copy link

modong commented Mar 4, 2016

It might be a good idea to use session instead of directly use requests here:
https://github.com/mbr/tinyrpc/blob/master/tinyrpc/transports/http.py#L25

Because with a fast enough server, the number of sockets available will run out quickly.

konradkonrad added a commit to konradkonrad/tinyrpc that referenced this issue Jan 24, 2017
This changes the default behavior of `HttpPostClientTransport` to use a
Session instead of creating a new request each time.
konradkonrad added a commit to konradkonrad/tinyrpc that referenced this issue Jan 25, 2017
Fixes mbr#26.

In some applications it is desirable to limit the number of ports used by a
client (see issue mbr#26). This change allows to supply an alternative method to
the default `requests.post` being used in `send_message`.

The change is introduced backwards compatible with the introduction of a new
kwarg to the constructor, `post_method=None`.

Users can create a `requests.Session()` instance, (optionally mount a
`requests.adapters.HTTPAdapter` to control the pool size), and supply
`post_method=session.post` as the kwarg.

`test_wsgi_transport.py::sessioned_client` shows an application of the kwarg.
`test_wsgi_transport.py::test_exhaust_ports` displays the problem with a non
sesioned `HttpPostClientTransport` instance.
konradkonrad added a commit to konradkonrad/tinyrpc that referenced this issue Jan 25, 2017
(Backported to `0.5` release tag)

Fixes mbr#26.

In some applications it is desirable to limit the number of ports used by a
client (see issue mbr#26). This change allows to supply an alternative method to
the default `requests.post` being used in `send_message`.

The change is introduced backwards compatible with the introduction of a new
kwarg to the constructor, `post_method=None`.

Users can create a `requests.Session()` instance, (optionally mount a
`requests.adapters.HTTPAdapter` to control the pool size), and supply
`post_method=session.post` as the kwarg.

`test_wsgi_transport.py::sessioned_client` shows an application of the kwarg.
`test_wsgi_transport.py::test_exhaust_ports` displays the problem with a non
sesioned `HttpPostClientTransport` instance.
@lnoor lnoor added this to the v0.6 milestone Aug 14, 2017
@lnoor lnoor closed this as completed in #31 Aug 18, 2017
georgemarshall pushed a commit to georgemarshall/tinyrpc that referenced this issue Mar 13, 2018
Fixes mbr#26.

In some applications it is desirable to limit the number of ports used by a
client (see issue mbr#26). This change allows to supply an alternative method to
the default `requests.post` being used in `send_message`.

The change is introduced backwards compatible with the introduction of a new
kwarg to the constructor, `post_method=None`.

Users can create a `requests.Session()` instance, (optionally mount a
`requests.adapters.HTTPAdapter` to control the pool size), and supply
`post_method=session.post` as the kwarg.

`test_wsgi_transport.py::sessioned_client` shows an application of the kwarg.
`test_wsgi_transport.py::test_exhaust_ports` displays the problem with a non
sesioned `HttpPostClientTransport` instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants