summaryrefslogtreecommitdiff
path: root/redis
Commit message (Collapse)AuthorAgeFilesLines
* remove unneccessary checkpid from SentinelConnectionPoolsentinel_pool_fixAndy McCurdy2019-03-141-12/+0
|
* actual 3.2.03.2.0Andy McCurdy2019-02-171-1/+1
|
* test all selectors via pytest parameterizationhealty_connectionsAndy McCurdy2019-02-111-20/+29
|
* python2 compatAndy McCurdy2019-02-041-1/+1
|
* attempt to provide only healthy connections from the poolAndy McCurdy2019-02-043-16/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adds redis.selector, a module that provides the best selector strategy available on the current platform. A redis.selector polls a socket to provide two pieces of functionality: 1. Check whether data can be read from the socket. Prior versions of redis-py provided this behavior with just select.select(). select() has lots of limitations, most notably a limit of ~1024 file descriptors. Now that better selectors are available, this should make can_read() faster and able to accomodate more clients. See #1115 and #486 2. Check whether a socket is ready for a command to be sent. This doubles as a health check. It ensures that the socket is available for writing, has no data to read and has no known errors. Anytime a socket is disconnected or hung up, data is available to be read, typically zero bytes. ConnectionPool.get_connection has been modified to ensure that connections it returns are connected and are ready for a command to be sent. If get_connection encounters a case where a socket isn't ready for a command the connection is reconnected and checked again. TODO: more tests for this stuff. implement EPoll and KQueue selectors. Fixes #1115 Fixes #486
* Merge pull request #1129 from Chronial/feature/fix-exceptAndy McCurdy2019-02-011-4/+4
|\ | | | | Do not leave connections in invalid state
| * 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
* | Merge branch 'pythonparser'Andy McCurdy2019-01-311-11/+5
|\ \
| * | 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
* | | 3.1.03.1.0Andy McCurdy2019-01-281-1/+1
|/ /
* | Connection URLs must have a valid scheme.Andy McCurdy2019-01-271-2/+6
| | | | | | | | | | Fixes #969 Fixes #961
* | Merge pull request #1023 from ycraaron/1022-fix-retry-logicAndy McCurdy2019-01-271-2/+4
|\ \ | | | | | | 1022: Fix retry logic for StricRedis and PubSub
| * | put not outside of the parenthesesAaron Yang2018-09-021-2/+2
| | |
| * | fix retry for PubSubAaron Yang2018-08-231-1/+2
| | |
| * | pep8Aaron Yang2018-08-231-1/+2
| | |
| * | fix retry logic for StricRedisAaron Yang2018-08-231-1/+1
| | |
* | | 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
| | |/ / | |/| |
* | | | Added a test for #1126Andy McCurdy2019-01-271-2/+2
| | | |
* | | | Merge pull request #1126 from guybe7/geohash_fixAndy McCurdy2019-01-271-1/+7
|\ \ \ \ | | | | | | | | | | GEOHASH response may contain None elements
| * | | | GEOHASH response may contain None elementsGuy Benoish2019-01-231-1/+7
| | | | |
* | | | | Merge branch 'master' into xreadgroup_handle_nil_fieldsAndy McCurdy2019-01-271-1/+4
|\ \ \ \ \ | |/ / / /
| * | | | Added noack option for XREADGROUPJohn T. Myers2019-01-101-1/+4
| | |_|/ | |/| |
* | | | Fix #1116 - trimmed stream causes exception on xreadgroup with id 0Xabier Eizmendi2019-01-101-0/+2
|/ / / | | | | | | | | | | | | | | | messages Signed-off-by: Xabier Eizmendi <xeizmendi@gmail.com>
* | | Lock objects now support specifying token values and ownership checkingAndy McCurdy2019-01-021-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | Lock.acquire() can now be provided a token. If provided, this value will be used as the value stored in Redis to hold the lock. Lock.owned() returns a boolean indicating whether the lock is owned by the current instance.
* | | Merge pull request #1014 from ikalnytskyi/lock-resetAndy McCurdy2018-12-281-0/+36
|\ \ \ | | | | | | | | Add `.reacquire()` method to Lock
| * | | Add `.reacquire()` method to LockIhor Kalnytskyi2018-12-281-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Lock` class provides a method called `.extend()` to manage a TTL of the acquired lock. However, the method allows only to extend a timeout of existing lock by N seconds, there's no way you can reset a TTL to the timeout value you passed to this lock. There could be multiple use cases for such behaviour. For instance, one may want to use a lock to implement active/passive behaviour where only one process owns a lock and resets its TTL all over again until it dies. This commit adds a new method called `.reacquire()` to reset a TTL of the acquired lock back to the passed timeout value.
* | | | Remove unnecessary compat shim for 'bytes'Jon Dufresne2018-12-283-4/+2
|/ / / | | | | | | | | | | | | | | | 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.
* | | Encode Stream message names within XREAD and XREADGROUP responses correctlyAndy McCurdy2018-12-271-1/+1
| | | | | | | | | | | | Stream message now respect the decode_responses flag.
* | | XPENDING range queries no longer allow COUNT to be infiniteAndy McCurdy2018-12-271-7/+4
| | | | | | | | | | | | | | | | | | | | | Redis 5.0.1 and beyond require that COUNT be specified as a positive integer. Since we can't guess the maximum possible value (UULONG_MAX can vary based on server architecture), force min/max/count to be required arguments
* | | ZADD correctly returns None in certain edge cases when incr=TrueAndy McCurdy2018-12-271-0/+2
| | | | | | | | | | | | | | | | | | | | | When incr=True and xx=True and an element is specified that doesn't exist the Redis server returns None. redis-py now does this as well. Fixes #1084
* | | Merge pull request #1077 from oranagra/fix_info_parsingAndy McCurdy2018-12-181-2/+6
|\ \ \ | | | | | | | | Re-fix the recently broken INFO parsing, see #1018
| * | | Re-fix the recently broken INFO parsing, see #1018Oran Agra2018-11-181-2/+6
| | | | | | | | | | | | | | | | | | | | The value part of the info line may contains : in many cases, most importantly an IPv6 slave address, may cause the parser to crash.
* | | | Merge pull request #1098 from theodesp/client-kill-filterAndy McCurdy2018-12-171-1/+43
|\ \ \ \ | | | | | | | | | | Add client kill with filter
| * | | | pep8 fixAndy McCurdy2018-12-171-2/+4
| | | | |
| * | | | fix missing parensAndy McCurdy2018-12-171-2/+2
| | | | |
| * | | | small cleanup of client_kill_filterAndy McCurdy2018-12-171-23/+21
| | | | | | | | | | | | | | | | | | | | changed skipme to a bool use a list to accumulate filter options
| * | | | Code review fixesTheo Despoudis2018-12-061-29/+38
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
| * | | | Fixes codestyle issuesTheo Despoudis2018-12-041-10/+12
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
| * | | | Simplified key, value handling inside for-range loopTheo Despoudis2018-12-041-4/+3
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
| * | | | Removed ambiguous argument handlingTheo Despoudis2018-12-041-2/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Theo Despoudis <thdespou@hotmail.com>