summaryrefslogtreecommitdiff
path: root/redis/connection.py
Commit message (Collapse)AuthorAgeFilesLines
...
| * Do not leave connections in invalid stateChronial2019-01-301-4/+4
| |
* | Merge pull request #1130 from Junnplus/socket-patchAndy McCurdy2019-02-011-1/+1
|\ \ | | | | | | Use IPPROTO_TCP constant instead of SOL_TCP constant
| * | use IPPROTO_TCP constant instead of SOL_TCP constantjunnplus2019-01-311-1/+1
| |/
* | readd the connection destructorAndy McCurdy2019-02-011-0/+6
| | | | | | | | | | | | Since Connection.disconnect() now verifies that the current process owns the connection before shutting the socket down we can safely readd the destructor just to make sure things are really cleaned up
* | Improve how connection pools operate in forked/child proceeses.Andy McCurdy2019-01-311-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes a process with an active connection to Redis forks and creates child processes taht also want to talk to Redis. Prior to this change there were a number of potential conflicts that could cause this to fail. Retrieving a connection from the pool and releasing a connection back to the pool check the current proceeses PID. If it's different than the PID that created the pool, reset() is called to get a fresh set of connections for the current process. However in doing so, pool.disconnect() was caused which closes the file descriptors that the parent may still be using. Further when the available_connections and in_use_connections lists are reset, all of those connections inherited from the parent are GC'd and the connection's `__del__` was called, which also closed the socket and file descriptor. This change prevents pool.disconnect() from being called when a pid is changed. It also removes the `__del__` destructor from connections. Neither of these are necessary or practical. Child processes still reset() their copy of the pool when first accessed causing their own connections to be created. `ConnectionPool.disconnect()` now checks the current process ID so that a child or parent can't disconnect the other's connections. Additionally, `Connection.disconnect()` now checks the current process ID and only calls `socket.shutdown()` if `disconnect()` is called by the same process that created the connection. This allows for a child process that inherited a connection to call `Connection.disconnect()` and not shutdown the parent's copy of the socket. Fixes #863 Fixes #784 Fixes #732 Fixes #1085 Fixes #504
* | Merge branch 'pr/1108' into pythonparserAndy McCurdy2019-01-281-3/+1
|\ \ | |/ |/|
| * Make PythonParser's on_disconnect consistent withAlexey Popravka2019-01-031-3/+1
| | | | | | | | | | Hiredisparser and Connection — do not close socket on disconnect. Resolves #1085
* | Connection URLs must have a valid scheme.Andy McCurdy2019-01-271-2/+6
| | | | | | | | | | Fixes #969 Fixes #961
* | Merge pull request #1087 from oridistor/ssl_sniAndy McCurdy2019-01-271-5/+18
|\ \ | | | | | | Add support for SNI connection to Redis-py
| * | pycodestyle fixes to connection.pyRoey Prat2018-11-271-4/+5
| | |
| * | Made sure SSL SNI will not affect using redis-py in versions older than 2.7.9Ori Markovitch2018-11-261-9/+17
| | |
| * | Add SSL SNI supportDanni Moiseyev2018-11-261-5/+9
| | |
* | | Merge pull request #1043 from Siecje/reprAndy McCurdy2019-01-271-1/+1
|\ \ \ | |_|/ |/| | Fix ConnectionPool repr when using default values
| * | Fix ConnectionPool repr when using default valuesCody Scot2018-10-261-1/+1
| | |
* | | Remove unnecessary compat shim for 'bytes'Jon Dufresne2018-12-281-1/+1
| |/ |/| | | | | | | | | Both Python 2.7 & Python 3 have the types bytes. On Python 2.7, it is an alias for the type str, same as what was previously defined in _compat.py.
* | Add missing UnixDomainSocketConnection._buffer_cutoffJyrki Muukkonen2018-11-151-0/+1
| | | | | | | | | | | | | | | | Without this using `unix_socket_path` will fail: AttributeError: 'UnixDomainSocketConnection' object has no attribute '_buffer_cutoff' Fixes #1067
* | Merge pull request #1017 from u2mejc/issue-1016Andy McCurdy2018-11-141-2/+2
|\ \ | | | | | | Enforce ssl_cert_reqs='required' by default
| * | Enforce ssl_cert_reqs='required' by defaultJustin Clark2018-08-071-2/+2
| |/
* | Merge pull request #1055 from tzickel/pipeperfAndy McCurdy2018-11-141-8/+15
|\ \ | | | | | | Improve performence of transactions / pipeline requests which involve large chunks of data.
| * | Improve performence of transactions / pipeline requests which involve largetzickel2018-11-061-8/+15
| | | | | | | | | | | | chunks of data.
* | | use str() to encode int or long valuesAndy McCurdy2018-11-141-1/+4
| | | | | | | | | | | | | | | on python2.7, repr() on a long produces '123L', which is clearly not what we want
* | | only accept bytes, strings, ints, longs and floats as user inputAndy McCurdy2018-11-141-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All input sent to Redis is coerced into bytes. This includes key names and values. Prior to this change, redis-py made an effort to cooerce all input into strings by calling str() (Python 3) or unicode() (Python 2). While this works for a handful of types like ints, longs and floats, it fails for other types like bools ('True' or 'False'), None ('None') and many user defined types. Starting with redis-py version 3.0, sending input of any other type is considered an error an a DataError exception will be raised. Fixes #471 Fixes #472 Fixes #321 Fixes #190
* | | Use unicode literals throughout projectJon Dufresne2018-11-031-31/+17
| | | | | | | | | | | | Remove workaround for handling unicode with older Pythons.
* | | Use io package for BytesIOJon Dufresne2018-11-031-2/+3
| | | | | | | | | | | | Available on all supported Python versions.
* | | Pass iterator to tuple() without coercing to a listJon Dufresne2018-11-031-2/+2
| | |
* | | Remove from __future__ import with_statementJon Dufresne2018-11-031-1/+0
|/ / | | | | | | All supported Python versions support the with statement.
* | Merge pull request #985 from mmaslowskicc/from-url-max-connectionsAndy McCurdy2018-11-021-1/+2
|\ \ | | | | | | Fix parsing max_connections URL query string parameter
| * | Fix parsing max_connections URL query string parameterMichał Masłowski2018-05-231-1/+2
| |/ | | | | | | | | Previously ConnectionPool.from_url kept it as a string, causing a 'ValueError: "max_connections" must be a positive integer'.
* | Prefer https:// for URLs when availableJon Dufresne2018-11-011-3/+4
| |
* | pycodestyle fixes in clientRoey Prat2018-10-281-5/+5
|/
* Allow socket type to be configured in ConnectionAJ Ortega2017-11-071-2/+3
|
* add an Encoder object responsible for encoding/decoding bytes and stringsAndy McCurdy2017-08-021-39/+49
| | | | this simplifies multiple places that needs to encode and decode values
* added get_encoding() to ConnectionPoolAndy McCurdy2017-07-311-0/+10
|
* insert missing wordPeter van Dijk2016-11-151-2/+2
|
* Merge pull request #645 from cvrebert/redis-urlAndy McCurdy2016-09-061-3/+8
|\ | | | | Link to redis:// & rediss:// scheme IANA registrations in docs
| * Link to redis:// & rediss:// scheme IANA registrations in docsChris Rebert2015-08-131-3/+8
| |
* | Cache Token objects to improve performance.Chris Simpson2016-06-121-3/+21
| | | | | | | | | | | | | | | | The Token class now contains a cache of tokens, and each token stores its encoded value. In Python 3 this prevents encoding the Token commands (get, set, incr, etc...) repeatly. There is also a smaller performance improvement by creating fewer objects. A very basic benchmark script was also added.
* | Retry `select` calls on `InterruptedError`Carlton Gibson2016-06-101-2/+1
| | | | | | | | Ref #738
* | For Python < 3.5, automatically retry EINTRThomas Steinacher2016-05-241-4/+4
| |
* | PEP8 fixesTim Savage2016-03-291-5/+11
| |
* | Extend ConnectionPool.to_url to parse querystring arguments to correct type.Tim Savage2016-03-291-3/+30
| | | | | | | | | | Previously if a value for socket_timeout was supplied as part fo the URL an error would be raised when a socket was created with an invalid type, this change fixes that by parsing `socket_timeout`, `socket_connect_timeout` to float values. In addition the boolean values `socket_keepalive` and `retry_on_timeout` are parsed to bool types taking into account the usage of True/False, Yes/No strings.
* | raise TimeoutError if a socket.timeout is raised while connectingAndy McCurdy2015-11-091-0/+2
| | | | | | | | fixes #675
* | socket errors on windows contain more than 2 arguments.Andy McCurdy2015-11-021-3/+4
| | | | | | | | fixes #641
* | typoAndy McCurdy2015-11-021-2/+2
| |
* | ignore errors raised in SocketBuffer's close method. See #633.Andy McCurdy2015-11-021-2/+10
| |
* | cleanupAndy McCurdy2015-11-021-7/+2
| |
* | decreased length of exception class retrieving lineth13f2015-10-261-1/+4
| |
* | parsing 'max number of clients reached' as ConnectionErrorth13f2015-10-261-2/+9
| |
* | removed the proactive check in HiredisParser for a line endingAndy McCurdy2015-09-281-9/+0
|/ | | | | it turns out just calling into hiredis to test this is faster than doing string compare in Python. fixes #615 and #650.
* fix: Connection.encode complains when value is an object having unicode ↵Eric Du2015-05-041-1/+1
| | | | characters in its printable representation